code: @Override
      public void taskStopping() {
          if (suspendTranOfExecutionThread) {
              Throwable exception = null;
  
              // Cleanup any unresolved transactions.
              UOWCurrent uowCurrent = EmbeddableTransactionManagerFactory.getUOWCurrent();
              switch (uowCurrent.getUOWType()) {
                  case UOWCurrent.UOW_GLOBAL:
                      // Rollback global transactions.
                      try {
                          EmbeddableWebSphereTransactionManager tm = EmbeddableTransactionManagerFactory.getTransactionManager();
                          tm.rollback();
                          exception = new Exception("Global transaction rolled back.");
                      } catch (Exception e) {
                          exception = e;
                      }
                      break;
  
                  case UOWCurrent.UOW_LOCAL:
                      // Commit local transaction.
                      try {
                          LocalTransactionCurrent ltCurrent = EmbeddableTransactionManagerFactory.getLocalTransactionCurrent();
                          ltCurrent.end(LocalTransactionCoordinator.EndModeCommit);
                      } catch (Exception e) {
                          exception = e;
                      }
                      break;
  
                  case UOWCurrent.UOW_NONE:
                      break;
                  default:
                      exception = new Exception("Invalid transaction type: " + uowCurrent.getUOWType());
                      break;
              }
  
              // Resume the original transaction.    
              try {
                  if (suspendedUOW != null) {
                      UOWManager uowManager = UOWManagerFactory.getUOWManager();
                      uowManager.resume(suspendedUOW);
                      suspendedUOW = null;
                  }
              } catch (Throwable e) {
                  exception = e;
              }
  
              // Throw any pending exception.
              if (exception != null) {
                  throw new IllegalStateException(exception);
              }
          }
      }
docs: {@inheritDoc}