docs: public void cleanup() throws InconsistentLocalTranException, IllegalStateException,
      RolledbackException
      {
          if (tc.isEntryEnabled()) Tr.entry(tc, "cleanup", this);
  
          try
          {
              if (_state != Running)
              {
                  final IllegalStateException ise = new IllegalStateException("Cannot cleanup LocalTransactionContainment. LocalTransactionCoordinator is completing or completed.");
                  FFDCFilter.processException(ise, "com.ibm.tx.ltc.LocalTranCoordImpl.cleanup", "958", this);
                  Tr.error(tc, "ERR_LTC_COMPLETE");
                  if (tc.isEntryEnabled()) Tr.exit(tc, "cleanup", ise);
                  throw ise;
              }
  
              // On WebSphere for z/OS we need to make sure that the unit
              // of work we are about to complete is associated with the
              // current thread of execution.  If we're not executing on
              // the current thread, the work done out of the registered
              // synchronizations will not be done on the right runtime
              // context.  This method should never fail unless we're
              // down an activity session path that we haven't coded for.
              ensureActive();
  
              // Are there any dangling RMLTs?
              boolean danglers = zosCheckInterests();
  
              if ((_cleanupResources != null) && (!_cleanupResources.isEmpty()))
              {
                  danglers = true;
              }
  
              // Set the outcome direction in which to resolve any danglers.
              // If there are no danglers, then this is influenced only by whether we are
              // set to rollbackOnly.                                @116975
  
              if (danglers)
              {
                  _outcomeRollback = (_rollbackOnly || !_unresActionIsCommit);
              }
              else
              {
                  _outcomeRollback = _rollbackOnly;
              }
  
              // Only generate completion performance metrics if the following conditions hold:
              // 1. The performance metrics recorder is available
              // 2. At least one resource has been registered with the LTC (otherwise we would
              //    not have made the original started() call and the metrics would be damaged)
              boolean generateCommitMetrics = false;
              if (startTime != 0)
              {
                  generateCommitMetrics=true;
                  perfCommitRequested();
              }
  
              //
              // Need to fire synchronizations
              // if we are commiting the work.
              //
              if (!_outcomeRollback)
              {
                  informSynchronizations(true);
              }
  
              // Defect 122329
              //
              // Change state once synchronizations have been called
              // to allow enlistment during beforeCompletion.
              //
              _state = Completing;
  
              //
              // Need to re-calculate if we have any danglers
              // as some may have been enlisted during beforeCompletion
              //
              danglers = zosCheckInterests();
  
              if ((_cleanupResources != null) && (!_cleanupResources.isEmpty()))
              {  
                  danglers = true;
              }
  
              // APAR PK08578
              //
              // Need to check again for rollback_only since it may be set during
              // beforeCompletion processing.
              if (danglers)                                            /* @PK08578A*/
              {                                                        /*2@PK08578A*/
                  _outcomeRollback = (_rollbackOnly || !_unresActionIsCommit);
              }                                                        /* @PK08578A*/
              else                                                     /* @PK08578A*/
              {                                                        /* @PK08578A*/
                  _outcomeRollback = _rollbackOnly;                    /* @PK08578A*/
              }                                                        /* @PK08578A*/
  
              List<String> failures = null;
  
              if ((danglers) && (_cleanupResources != null)) // @D220424C
              {            
                  for (int i = 0; i < _cleanupResources.size(); i++)
                  {
                      OnePhaseXAResource resource = _cleanupResources.get(i);
  
                      try
                      {
                          if (_outcomeRollback)
                          {
                              if (tc.isDebugEnabled()) Tr.debug(tc, "Calling rollback on resource " + resource);
                              resource.rollback(null);
                              // 130828 add messages for resources rolledback in cleanup
                              Tr.warning(tc, "WRN_RESOURCE_UNRESOLVED_LTC_ROLLEDBACK", resource.getResourceName());
                          }
                          else
                          {
                              if (tc.isDebugEnabled()) Tr.debug(tc, "Calling commit on resource " + resource);
                              resource.commit(null, true);
                          }
                      }
                      catch (XAException xe)
                      {
                          //
                          // Log any failures. We don't need to throw
                          // as user has already detached.
                          //
                          FFDCFilter.processException(xe, "com.ibm.tx.ltc.LocalTranCoordImpl.cleanup", "755", this);
                          if (failures == null)
                          {
                              failures = new ArrayList<String>();
                          }
                          failures.add(resource.getResourceName());
  
                          Tr.error(tc, "ERR_XA_RESOURCE_COMPLETE", new Object[] {resource.getResourceName(), xe});
                      }
                  }
              }
  
              final String zosFailure = zosComplete();
              if (zosFailure != null)
              {
                  if (failures == null)
                  {
                      failures = new ArrayList<String>();
                  }
                  failures.add(zosFailure);
  
              }
  
              postCleanup();
  		
              _state = Completed;
  
              //
              // Need to fire synchronizations even if
              // there is no work to be done.
              //
              informSynchronizations(true);
  
              if (generateCommitMetrics)
              {
                  perfCompleted(0, startTime, !_outcomeRollback);
              }
  
              //
              // Cleanup all our outstanding objects for
              // garbage collection.
              //
              _cleanupResources  = null;
              _enlistedResources = null;
              _syncs = null;
  
              // Defect 130218.2
              //
              // Clear the ltc from the Thread context
              //
              if (_current.getLocalTranCoord() == this)
              {
                  if (tc.isDebugEnabled()) Tr.debug(tc, "Completed LTC is on thread so set current LTC to null");
                  _current.setCoordinator(null);
              }
  
              //
              // Defect 115015
              //
              // Need to throw any exceptions after all Synchronizations
              // have been informed to ensure any dependant cleanup takes
              // place.
              //
              if (failures != null)
              {
                  final String[] out = new String[failures.size()];
                  final InconsistentLocalTranException ilte = new InconsistentLocalTranException("Resource(s) failed to complete.", failures.toArray(out));
                  if (tc.isEntryEnabled()) Tr.exit(tc, "cleanup", ilte);
                  throw ilte;
              }
  
              //
              // Defect 116861
              //
              // Throw exception if we rolledback any dangers
              //
              if (_outcomeRollback  && !_rollbackOnlyFromApplicationCode)
              {
                  RolledbackException rbe = null;
              
                  // 130828 vary trace on cause of rollback
              
                  // Only output a message and throw a RBE if rollback only was set by
                  // the WAS runtime. If the rollback was requested by application code
                  // then the rollback is part of application logic and shouldn't be
                  // treated as an exception.
                  if (_rollbackOnly)
                  {
  	                Tr.error(tc, "ERR_XA_RESOURCE_ROLLEDBACK");
       	            rbe = new RolledbackException("Resources rolled back due to setRollbackOnly() being called.");            	
                  }
                  else
                  {
                      Tr.warning(tc, "WRN_LTC_UNRESOLVED_ROLLEDBACK");
                      rbe = new RolledbackException("Resources rolled back due to unresolved action of rollback.");
                  }
  
                  if (tc.isEntryEnabled()) Tr.exit(tc, "cleanup", rbe);
                  throw rbe;
              }
          }
          finally
          {
              if(_current != null)
              {
                  if (tc.isDebugEnabled()) 
                    Tr.debug(tc, "Drive invokeEventListener processing");
                  _current.invokeEventListener(this, UOWEventListener.POST_END, null);
              }
              else
              {
          	if (tc.isDebugEnabled()) Tr.debug(tc, "current is null");
              }
          }
          
          if (tc.isEntryEnabled()) Tr.exit(tc, "cleanup");
      }