Links referenced resource to current transaction thread.

@param implementor
resource implementor.
326427
public void setImplementor(ResourceManager implementor)
    {
        KunderaTransaction tx = threadLocal.get();
        if (tx == null)
        {
            throw new IllegalStateException("Cannot get Transaction to start");
        }
        tx.setImplementor(implementor);

    }
1332506
@Override
    public void setResourceAdapter(final ResourceAdapter resourceAdapter) {
        if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled()) {
            SibTr.debug(this, TRACE, "setResourceAdapter", resourceAdapter);
        }
        _resourceAdapter = resourceAdapter;
    }
903939
public final void commit() throws XAException
    {
        if (tc.isEntryEnabled()) Tr.entry(tc, "commit", _resource);

        Tr.warning(tc, "WTRN0018_1PC_RESOURCE_DOES_NOT_SUPPORT_COMMIT");
        if (tc.isEntryEnabled()) Tr.exit(tc, "commit");
        throw new XAException(XAException.XAER_PROTO);
    }
808821
@Reference(service = LocalTransactionCurrent.class)
    protected void setLocalTransactionCurrent(ServiceReference<LocalTransactionCurrent> ref) {
        localTranCurrentRef.setReference(ref);
    }
826002
private static void initInstance(final TransactionLogger instance, final Logger logger, final Logger auditor) {
    instance.logger = logger;
    instance.auditor = auditor;
    instance.components = new LinkedHashMap<>();
    instance.properties = new LinkedHashMap<>();
    instance.total = new Component(TOTAL_COMPONENT);
    instance.total.startTimer();
    instance.componentsMultiThread = new ComponentsMultiThread();
    instance.flowContext = FlowContextFactory.serializeNativeFlowContext();
  }
132851
private void updateLinkedRequestAppDataMapping(final ClientTransaction ctx,
			Dialog dialog) {
		if(logger.isDebugEnabled()) {
			logger.debug("updateLinkedRequestAppDataMapping");
		}
		final Transaction linkedTransaction = linkedRequest.getTransaction();
		final Dialog linkedDialog = linkedRequest.getDialog();
		//keeping the client transaction in the server transaction's application data
		if(linkedTransaction != null && linkedTransaction.getApplicationData() != null) {
			((TransactionApplicationData)linkedTransaction.getApplicationData()).setTransaction(ctx);
		}
		if(linkedDialog != null && linkedDialog.getApplicationData() != null) {
			((TransactionApplicationData)linkedDialog.getApplicationData()).setTransaction(ctx);
		}
		//keeping the server transaction in the client transaction's application data
		this.transactionApplicationData.setTransaction(linkedTransaction);
		if(dialog!= null && dialog.getApplicationData() != null) {
			((TransactionApplicationData)dialog.getApplicationData()).setTransaction(linkedTransaction);
		}
	}
573469
public static void replaceMainThreadExecutor(MainThreadExecutor executor) {
		MainThreadExecutor previous;
		synchronized (LCCore.class) {
			previous = mainThreadExecutor;
			mainThreadExecutor = executor;
		}
		do {
			Runnable toExecute = previous.pop();
			if (toExecute == null) break;
			executor.execute(toExecute);
		} while (true);
	}
109171
public void addDependentResourceReference(ResourceReference<?> resourceReference) {
        if (resourceReferences == null) {
            this.resourceReferences = new ArrayList<ResourceReference<?>>();
        }
        this.resourceReferences.add(resourceReference);
    }
384665
public final void commitPersistLock(PersistentTransaction transaction) throws SevereMessageStoreException
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "commitPersistLock", transaction);

        AbstractItem item = null;
        boolean hasBecomePersistentlyLocked = false;
        boolean linkHasBecomeReleasable = false;
        synchronized (this)
        {
            if (ItemLinkState.STATE_PERSISTING_LOCK == _itemLinkState)
            {
                _assertCorrectTransaction(transaction);
                item = _getAndAssertItem();
                final int strategy = _tuple.getStorageStrategy();
                if ((AbstractItem.STORE_NEVER != strategy) &&
                    (AbstractItem.STORE_MAYBE != strategy))
                { // 272110 - added STORE_MAYBE to ease handling of corrupt persistent representation
                  // storable items can be discarded if in persistentLocked state
                    linkHasBecomeReleasable = _declareDiscardable();
                }
                _itemLinkState = ItemLinkState.STATE_PERSISTENTLY_LOCKED;
                hasBecomePersistentlyLocked = true;
            }
            else
            {
                if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled())
                    SibTr.event(this, tc, "Invalid Item state: " + _itemLinkState);
                if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                    SibTr.exit(this, tc, "commitPersistLock");
                throw new StateException(_itemLinkState.toString());
            }
            _transactionId = null;
        }
        if (hasBecomePersistentlyLocked)
        {
            if (linkHasBecomeReleasable)
            {
                _declareReleasable(item);
            }
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "commitPersistLock");
    }
750776
public void addProvider(UserTransactionProvider provider)
   {
      UserTransactionProviderImpl impl = new UserTransactionProviderImpl(provider);

      delegator.addProvider(impl);
      providers.put(provider, impl);
   }
515470
public void setImplementors(Map<Class<?>, CloneImplementor> implementors) {
		// this.implementors = implementors;

		this.allImplementors = new HashMap<Class<?>, CloneImplementor>();
		allImplementors.putAll(builtInImplementors);
		allImplementors.putAll(implementors);
	}
881466
private void commitPending() throws IOException
   {
      if (pending.isEmpty())
      {
         return;
      }
      super.addDocuments((Document[])pending.values().toArray(new Document[pending.size()]));
      pending.clear();
      aggregateIndexes.clear();
   }
178218
private void addLinkedResource(FilePathMapping linkedResource) {
		linkedResources.add(linkedResource);
		if (parent != null) {
			parent.addLinkedResource(linkedResource);
		}
	}
657765
private void registerListener(final ChangesLogWrapper logWrapper, TransactionableResourceManager txResourceManager)
      throws RepositoryException
   {
      try
      {
         // Why calling the listeners non tx aware has been done like this:
         // 1. If we call them in the commit phase and we use Arjuna with ISPN, we get:
         //       ActionStatus.COMMITTING > is not in a valid state to be invoking cache operations on.
         //       at org.infinispan.interceptors.TxInterceptor.enlist(TxInterceptor.java:195)
         //       at org.infinispan.interceptors.TxInterceptor.enlistReadAndInvokeNext(TxInterceptor.java:167)
         //       at org.infinispan.interceptors.TxInterceptor.visitGetKeyValueCommand(TxInterceptor.java:162)
         //       at org.infinispan.commands.read.GetKeyValueCommand.acceptVisitor(GetKeyValueCommand.java:64)
         //    This is due to the fact that ISPN enlist the cache even for a read access and enlistments are not 
         //    allowed in the commit phase
         // 2. If we call them in the commit phase, we use Arjuna with ISPN and we suspend the current tx,
         //    we get deadlocks because we try to acquire locks on cache entries that have been locked by the main tx.
         // 3. If we call them in the afterComplete, we use JOTM with ISPN and we suspend and resume the current tx, we get:
         //       jotm: resume: Invalid Transaction Status:STATUS_COMMITTED (Current.java, line 743) 
         //       javax.transaction.InvalidTransactionException: Invalid resume org.objectweb.jotm.TransactionImpl
         //       at org.objectweb.jotm.Current.resume(Current.java:744)
         //    This is due to the fact that it is not allowed to resume a tx when its status is STATUS_COMMITED

         txResourceManager.addListener(new TransactionableResourceManagerListener()
         {
            public void onCommit(boolean onePhase) throws Exception
            {
            }

            public void onAfterCompletion(int status) throws Exception
            {
               if (status == Status.STATUS_COMMITTED)
               {
                  // Since the tx is successfully committed we can call components non tx aware

                  // The listeners will need to be executed outside the current tx so we suspend
                  // the current tx we can face enlistment issues on product like ISPN
                  transactionManager.suspend();

                  SecurityHelper.doPrivilegedAction(new PrivilegedAction<Void>()
                  {
                     public Void run()
                     {
                        notifySaveItems(logWrapper.getChangesLog(), false);
                        return null;
                     }
                  });
                  // Since the resume method could cause issue with some TM at this stage, we don't resume the tx
               }
            }

            public void onAbort() throws Exception
            {
            }
         });
      }
      catch (Exception e)
      {
         throw new RepositoryException("The listener for the components not tx aware could not be added", e);
      }
   }
624545
static <K, V> void connectExpirables(ReferenceEntry<K, V> previous, ReferenceEntry<K, V> next) {
    previous.setNextExpirable(next);
    next.setPreviousExpirable(previous);
  }
94908
public void initialiseNonPersistent(MessageProcessor messageProcessor,
                                      SIMPTransactionManager txManager)
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "initialiseNonPersistent", messageProcessor);

    //Release 1 has no Link Bundle IDs for this Neighbour

    // Cache the reference to the message processor
    _messageProcessor = messageProcessor;

    // Create the ObjectPool that will be used to store the 
    // subscriptionMessages.  Creating with an intial length of
    // 2, but this could be made a settable parameter for performance
    _subscriptionMessagePool = new ObjectPool("SubscriptionMessages", NUM_MESSAGES);

    // Create a new object to contain all the Neighbours
    _neighbours = new Neighbours(this, _messageProcessor.getMessagingEngineBus());

    // Create a new LockManager instance
    _lockManager = new LockManager();
    
    // Assign the transaction manager
    _transactionManager = txManager;
            
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "initialiseNonPersistent");
  }
708581
public void attachDS(Iterator<DataSet> iterator) {
        log.debug("Attaching thread...");

        //Count the number of minibatches - used for reporting/debugging purposes
        if(iteratorDataSetCount.get() == null)
            iteratorDataSetCount.set(new AtomicInteger(0));
        AtomicInteger count = iteratorDataSetCount.get();
        count.set(0);

        // we're creating our Observable wrapper
        VirtualIterator<DataSet> wrapped = new VirtualIterator<>(new CountingIterator<>(iterator, count));

        // and creating Observer which will be used to monitor progress within iterator
        BlockingObserver obs = new BlockingObserver(exceptionEncountered);
        wrapped.addObserver(obs);

        // putting that "somewhere"
        iteratorsDS.add(wrapped);

        // storing observer into ThreadLocal, since we're going to use that later
        observer.set(obs);
    }