Enlist a remote resouce with the transaction associated with the target
TransactionImpl object. Typically, this remote resource represents a
downstream suborindate server.

@param remoteRes the remote resource wrapped as a JTAResource
182777
public void enlistResource(JTAResource remoteRes) {
        if (tc.isEntryEnabled())
            Tr.entry(tc, "enlistResource (SPI): args: ", remoteRes);

        getResources().addRes(remoteRes);

        if (tc.isEntryEnabled())
            Tr.exit(tc, "enlistResource (SPI)");
    }
114885
@Override
   public void cleanupLeaverTransactions(List<Address> members) {
      Iterator<RemoteTransaction> it = getRemoteTransactions().iterator();
      while (it.hasNext()) {
         RecoveryAwareRemoteTransaction recTx = (RecoveryAwareRemoteTransaction) it.next();
         recTx.computeOrphan(members);
         if (recTx.isInDoubt()) {
            recoveryManager.registerInDoubtTransaction(recTx);
            it.remove();
         }
      }
      //this cleans up the transactions that are not yet prepared
      super.cleanupLeaverTransactions(members);
   }
1182912
void commitTransaction() throws JMSException {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "commitTransaction");

        try {
            jcaSession.commitLocalTransaction();
            uncommittedReceiveCount = 0;
        } catch (javax.resource.spi.IllegalStateException ise) {
            // No FFDC code needed
            // d238447 FFDC review. Generate FFDC
            throw (javax.jms.IllegalStateException) JmsErrorUtils.newThrowable(javax.jms.IllegalStateException.class,
                                                                               "EXCEPTION_RECEIVED_CWSIA0053",
                                                                               new Object[] { ise, "JmsSessionImpl.commitTransaction (#1)" },
                                                                               ise,
                                                                               "JmsSessionImpl.commitTransaction#1",
                                                                               this,
                                                                               tc
                            );
        } catch (javax.resource.spi.LocalTransactionException lte) {
            // No FFDC code needed
            // d238447 FFDC Review. LocalT thrown if no transaction in progress. Wouldn't expect
            //   us to call commit if this was the case, so generate FFDC.
            throw (javax.jms.IllegalStateException) JmsErrorUtils.newThrowable(javax.jms.IllegalStateException.class,
                                                                               "EXCEPTION_RECEIVED_CWSIA0053",
                                                                               new Object[] { lte, "JmsSessionImpl.commitTransaction (#2)" },
                                                                               lte,
                                                                               "JmsSessionImpl.commitTransaction#2",
                                                                               this,
                                                                               tc
                            );
        } catch (SIConnectionDroppedException e) { //PK60857  connection no longer available so tran will timeout and rollback on the server side
            // No FFDC code needed
            // Generate FFDC.
            rolledBackDueToConnectionFailure = true;
            throw (TransactionRolledBackException) JmsErrorUtils.newThrowable(
                                                                              TransactionRolledBackException.class, // subclass of JMSException
                                                                              "EXCEPTION_RECEIVED_CWSIA0053",
                                                                              new Object[] { e, "JmsSessionImpl.commitTransaction (#4)" },
                                                                              e,
                                                                              "JmsSessionImpl.commitTransaction#4",
                                                                              this,
                                                                              tc
                            );

        } catch (SIConnectionLostException e) { //PK60857  connection failed during the commit, result unknown.  This is a risk of 1PC, assume rollback.
            // No FFDC code needed
            // Generate FFDC.
            rolledBackDueToConnectionFailure = true;
            throw (TransactionRolledBackException) JmsErrorUtils.newThrowable(
                                                                              TransactionRolledBackException.class, // subclass of JMSException
                                                                              "EXCEPTION_RECEIVED_CWSIA0053",
                                                                              new Object[] { e, "JmsSessionImpl.commitTransaction (#5)" },
                                                                              e,
                                                                              "JmsSessionImpl.commitTransaction#5",
                                                                              this,
                                                                              tc
                            );
        }

        catch (Exception e) {
            // No FFDC code needed
            // d238447 FFDC review. Includes ResourceException, SIException, SIErrorException
            // Generate FFDC.
            throw (JMSException) JmsErrorUtils.newThrowable(JMSException.class,
                                                            "EXCEPTION_RECEIVED_CWSIA0053",
                                                            new Object[] { e, "JmsSessionImpl.commitTransaction (#3)" },
                                                            e,
                                                            "JmsSessionImpl.commitTransaction#3",
                                                            this,
                                                            tc
                            );
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "commitTransaction");
    }
118257
public void addAsyncResource(JTAAsyncResourceBase resource) throws SystemException
    {
        if (tc.isEntryEnabled())
            Tr.entry(tc, "addAsyncResource", new Object[] { this, resource });

        if (_asyncResourceObjects == null) {
            _asyncResourceObjects = new ArrayList<JTAAsyncResourceBase>();
        } else {
            for (JTAAsyncResourceBase asyncRes : _asyncResourceObjects) {
                if (resource.getKey().equals(asyncRes.getKey())) {
                    // Caller to determine appropriate action
                    final SystemException se = new SystemException("Cannot register two asynchronous resources with the same keys: " + asyncRes.getKey());
                    if (tc.isEntryEnabled())
                        Tr.exit(tc, "addAsyncResource", se);
                    throw se;
                }
            }
        }

        resource.setResourceStatus(StatefulResource.REGISTERED);
        _asyncResourceObjects.add(resource);

        if (tc.isEventEnabled())
            Tr.event(tc, "(SPI) SERVER registered with Transaction. TX: " + _transaction.getLocalTID() + ", Resource: " + resource);

        if (tc.isEntryEnabled())
            Tr.exit(tc, "addAsyncResource");
    }
789858
public void enlistWithTransaction(javax.transaction.Synchronization sync)
                    throws CSIException
    {
        SynchronizationRegistryUOWScope uowScope = getCurrentTransactionalUOW(false);
        if (uowScope == null)
        {
            throw new IllegalStateException("No active transaction");
        }

        enlistWithTransaction(uowScope, sync);
    }
1273930
@Override
    public void setRemoteServices(RemoteServices remoteServices) {
        final String methodName = "setRemoteServices(remoteServices)";
        if (tc.isDebugEnabled()) {
            Tr.debug(tc, methodName + " cacheName=" + cacheName + " ERROR because it should not be called");
        }
    }
131926
public final void commitInternal(final PersistentTransaction transaction)
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "commitInternal", transaction);

        getLink().internalCommitAdd();

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "commitInternal");
    }
1070515
@SuppressWarnings("unchecked")
   protected void associateResourceAdapter(javax.resource.spi.ResourceAdapter resourceAdapter, Object object)
      throws DeployException
   {
      if (resourceAdapter != null && object != null && object instanceof ResourceAdapterAssociation)
      {
         try
         {
            ResourceAdapterAssociation raa = (ResourceAdapterAssociation)object;
            raa.setResourceAdapter(resourceAdapter);
         }
         catch (Throwable t)
         {
            throw new DeployException(bundle.unableToAssociate(object.getClass().getName()), t);
         }
      }
   }
123813
public static void runExample(
      AdWordsServicesInterface adWordsServices, AdWordsSession session) throws RemoteException {
    // Get the UserListService.
    AdwordsUserListServiceInterface userListService =
        adWordsServices.get(session, AdwordsUserListServiceInterface.class);

    // Get the ConversionTrackerService.
    ConversionTrackerServiceInterface conversionTrackerService =
        adWordsServices.get(session, ConversionTrackerServiceInterface.class);

    // Create conversion type (tag).
    UserListConversionType conversionType = new UserListConversionType();
    conversionType.setName("Mars cruise customers #" + System.currentTimeMillis());

    // Create remarketing user list.
    BasicUserList userList = new BasicUserList();
    userList.setName("Mars cruise customers #" + System.currentTimeMillis());
    userList.setDescription("A list of mars cruise customers in the last year");
    userList.setMembershipLifeSpan(365L);
    userList.setConversionTypes(new UserListConversionType[] {conversionType});

    // You can optionally provide these field(s).
    userList.setStatus(UserListMembershipStatus.OPEN);

    // Create operations.
    UserListOperation operation = new UserListOperation();
    operation.setOperand(userList);
    operation.setOperator(Operator.ADD);

    UserListOperation[] operations = new UserListOperation[] {operation};

    // Add user list.
    UserListReturnValue result = userListService.mutate(operations);

    // Display results.
    // Capture the ID(s) of the conversion.
    List<String> conversionIds = new ArrayList<>();
    for (UserList userListResult : result.getValue()) {
      if (userListResult instanceof BasicUserList) {
        BasicUserList remarketingUserList = (BasicUserList) userListResult;
        for (UserListConversionType userListConversionType :
            remarketingUserList.getConversionTypes()) {
          conversionIds.add(userListConversionType.getId().toString());
        }
      }
    }

    // Create predicate and selector.
    Selector selector = new SelectorBuilder()
        .fields("Id", "GoogleGlobalSiteTag", "GoogleEventSnippet")
        .in(AdwordsUserListField.Id, conversionIds.toArray(new String[0]))
        .build();

    // Get all conversion trackers.
    Map<Long, AdWordsConversionTracker> conversionTrackers =
        new HashMap<Long, AdWordsConversionTracker>();
    ConversionTrackerPage page = conversionTrackerService.get(selector);
    if (page != null && page.getEntries() != null) {
      conversionTrackers =
          Arrays.stream(page.getEntries())
              .collect(
                  Collectors.toMap(
                      conversionTracker -> conversionTracker.getId(),
                      conversionTracker -> (AdWordsConversionTracker) conversionTracker));
    }

    // Display user lists.
    for (UserList userListResult : result.getValue()) {
      System.out.printf("User list with name '%s' and ID %d was added.%n",
          userListResult.getName(), userListResult.getId());

      // Display user list associated conversion code snippets.
      if (userListResult instanceof BasicUserList) {
        BasicUserList remarketingUserList = (BasicUserList) userListResult;
        for (UserListConversionType userListConversionType : remarketingUserList
            .getConversionTypes()) {
          ConversionTracker conversionTracker =
              conversionTrackers.get(userListConversionType.getId());
          System.out.printf(
              "Google global site tag:%n%s%n%n", conversionTracker.getGoogleGlobalSiteTag());
          System.out.printf(
              "Google event snippet:%n%s%n%n", conversionTracker.getGoogleEventSnippet());
        }
      }
    }
  }
1255616
public void setSourceDirs(String... sourceDirs) {
        if (sourceDirs == null)
            throw new IllegalArgumentException();
        this.sourceDirs = Arrays.asList(sourceDirs);
    }
936174
public boolean enlist(UOWCoordinator coord, XAResource xaRes, int recoveryIndex, int branchCoupling)
    throws RollbackException, IllegalStateException, SystemException
    {
        final boolean traceOn = TraceComponent.isAnyTracingEnabled();

        if (traceOn && tc.isEntryEnabled()) Tr.entry(tc, "enlist", new Object[] {xaRes, recoveryIndex, branchCoupling});

        boolean result = false;

        if (coord instanceof TransactionImpl)
        {
            try
            {
                result = ((TransactionImpl)coord).enlistResource(xaRes, recoveryIndex, branchCoupling);
            }
            finally
            {
                if (traceOn && tc.isEntryEnabled()) Tr.exit(tc, "enlist", result);
            }
        }
        else
        {
            final SystemException se = new SystemException("Invalid UOWCoordinator");
            FFDCFilter.processException(se, "com.ibm.tx.jta.impl.EmbeddableTranManagerSet.enlist", "154", this);
            if (traceOn && tc.isEntryEnabled()) Tr.exit(tc, "enlist", se);
            throw se;
        }
        
        return result;
    }
182945
public void doProcess(InputStream in, PrintWriter out, Map<String, Object> properties)
        throws RemoteException
    {
        String strCommand = this.getProperty(REMOTE_COMMAND, properties);
        if (SEND_MESSAGE.equals(strCommand))
        {
            BaseMessage message = (BaseMessage)this.getNextObjectParam(in, MESSAGE, properties);
            ((RemoteSendQueue)m_remoteObject).sendMessage(message);
        }
        else
            super.doProcess(in, out, properties);
    }
172829
public static void runExample(AdManagerServices adManagerServices, AdManagerSession session)
      throws RemoteException {
    // Get the ReconciliationReportService.
    ReconciliationReportServiceInterface reconciliationReportService =
        adManagerServices.get(session, ReconciliationReportServiceInterface.class);

    // Create a statement to select all reconciliation reports.
    StatementBuilder statementBuilder = new StatementBuilder()
        .orderBy("id ASC")
        .limit(StatementBuilder.SUGGESTED_PAGE_LIMIT);

    // Default for total result set size.
    int totalResultSetSize = 0;

    do {
      // Get reconciliation reports by statement.
      ReconciliationReportPage page =
          reconciliationReportService.getReconciliationReportsByStatement(
              statementBuilder.toStatement());

      if (page.getResults() != null) {
        totalResultSetSize = page.getTotalResultSetSize();
        int i = page.getStartIndex();
        for (ReconciliationReport reconciliationReport : page.getResults()) {
          System.out.printf(
              "%d) Reconciliation report with ID %d for month %d/%d was found.%n",
              i++,
              reconciliationReport.getId(),
              reconciliationReport.getStartDate().getMonth(),
              reconciliationReport.getStartDate().getYear());
        }
      }

      statementBuilder.increaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT);
    } while (statementBuilder.getOffset() < totalResultSetSize);

    System.out.printf("Number of results found: %d%n", totalResultSetSize);
  }
730094
protected void remoteInit() throws JMSException
    {
        CreateBrowserQuery query = new CreateBrowserQuery();
        query.setBrowserId(id);
        query.setSessionId(session.getId());
        query.setQueue(queue);
        query.setMessageSelector(messageSelector);
        transportEndpoint.blockingRequest(query);
    }
83993
private void enlistTransaction() {

        this.cleanupTransactionBinding();

        TransactionBindingType transactionBindingType = this.transactionBinding.getTransactionBindingType();

        // not associated to global transaction, try to associate a global
        // transaction
        if (this.isInGlobalTransaction() && transactionBindingType != TransactionBindingType.GlobalTransaction) {
            try {
                Transaction ntx = this.transactionManager.getTransaction();
                
                // Bitronix calls start on reaction of enlist --- check if cycle
                if (!enlisted && ntx != null) {
                    this.enlisted = true;
                    // enlisted makes startTransaactionalBranch calling
                    this.enlisted = ntx.enlistResource(this.xaResource);
                    if (!enlisted) {
                        LOG.error("Enlisting " + xaResource + " failed");
                    } else {

                    }
                } else {
                    LOG.debug("SampleXAConnection:connectionRequiresTransaction (no globalTransaction found)");
                }
            } catch (RollbackException n) {
                LOG.error("SampleXAConnection:prevokeAction enlistResource exception : " + n.toString());
            } catch (SystemException n) {
                LOG.error("SampleXAConnection:connectionRequiresTransaction " + n + "\n"
                        + ExceptionUtils.getStackTrace(n));
                throw new DelegatedRuntimeException(n);
            }
        } else if (transactionBindingType == TransactionBindingType.NoTransaction) {
            this.transactionBinding.activateLocalTransaction(new LocalTransactionProxy<C>(this.managedConnectionFactory
                    .getManagedConnection()));
        } else { // In Global Transaction and associated to a global transaction
                 // => nothing to do
            if (this.isInGlobalTransaction() && transactionBindingType == TransactionBindingType.GlobalTransaction) {
                // Not in Global Transaction and associated to a local
                // transaction => nothing to do
            } else if (!this.isInGlobalTransaction()
                    && transactionBindingType == TransactionBindingType.LocalTransaction) {
            }
        }

    }
1199042
private static RemoteObjectSource openObjectSource(ServiceInfo serviceInfo) {
        try {
            return new RemoteObjectSource(serviceInfo);
        } catch (ServiceException e) {
            throw new IllegalStateException("Failed to initialize "
                    + "the ValidatorProcess: ", e);
        } catch (IOException e) {
            throw new IllegalStateException("Failed to initialize "
                    + "the ValidatorProcess: ", e);
        }
    }
590334
@Override
	public boolean next() throws RemoteException {
		try {
			return s.next();
		} catch (RuntimeException e) {
			rconn.rollback();
			throw e;
		}
	}