LocalTransactionProvider getProvider() { return owner.getProvider(); }
/** * Get the XID of the local transaction. * * @return the transaction XID (not {@code null}) */ public Xid getXid() { return owner.getProvider().getXid(transaction); }
/** * Determine if this transaction was imported. * * @return {@code true} if the transaction was imported, {@code false} if it was initiated locally */ public boolean isImported() { return owner.getProvider().isImported(transaction); }
/** * Get the name of the node which initiated the transaction. * * @return the name of the node which initiated the transaction, or {@code null} if it could not be determined */ public String getParentName() { return owner.getProvider().getNameFromXid(owner.getProvider().getXid(transaction)); }
public int getTransactionTimeout() { return owner.getProvider().getTimeout(transaction); }
boolean getRollbackOnly() { return owner.getProvider().getRollbackOnly(transaction); }
public <T> T getProviderInterface(final Class<T> providerInterfaceType) { return owner.getProvider().getProviderInterface(transaction, providerInterfaceType); }
Object getKey() { return owner.getProvider().getKey(transaction); }
void verifyAssociation() { TransactionManager transactionManager = owner.getProvider().getTransactionManager(); try { final Transaction transactionManagerTransaction = transactionManager.getTransaction(); if (! transaction.equals(transactionManagerTransaction)) { throw Log.log.unexpectedProviderTransactionMismatch(transaction, transactionManagerTransaction); } } catch (SystemException e) { // should be impossible throw Log.log.invalidTxnState(); } }
public Object putResourceIfAbsent(final Object key, final Object value) throws IllegalArgumentException { return owner.getProvider().putResourceIfAbsent(transaction, Assert.checkNotNullParamWithNullPointerException("key", key), value); }
public Object getResource(final Object key) throws NullPointerException { return owner.getProvider().getResource(transaction, Assert.checkNotNullParamWithNullPointerException("key", key)); }
public void putResource(final Object key, final Object value) throws NullPointerException { owner.getProvider().putResource(transaction, Assert.checkNotNullParamWithNullPointerException("key", key), value); }
void suspend() throws SystemException { notifyAssociationListeners(false); TransactionManager transactionManager = owner.getProvider().getTransactionManager(); if (! transaction.equals(transactionManager.getTransaction())) { throw Log.log.unexpectedProviderTransactionMismatch(transaction, transactionManager.getTransaction()); } final Transaction transactionManagerTransaction = transactionManager.suspend(); if (! transaction.equals(transactionManagerTransaction)) { throw Log.log.unexpectedProviderTransactionMismatch(transaction, transactionManagerTransaction); } }
boolean importBacking() throws SystemException { final ContextTransactionManager.State state = ContextTransactionManager.INSTANCE.getStateRef().get(); final Transaction transaction = owner.getProvider().getTransactionManager().getTransaction(); if (transaction == null) { return false; } final LocalTransaction localTransaction = owner.getOrAttach(transaction, CreationListener.CreatedBy.MERGE); if (state.transaction == null) { state.transaction = localTransaction; return true; } else { localTransaction.verifyAssociation(); return false; } }
void registerInterposedSynchronization(final Synchronization sync) throws IllegalStateException { Assert.checkNotNullParam("sync", sync); owner.getProvider().registerInterposedSynchronization(transaction, new AssociatingSynchronization(sync)); }
void resume() throws SystemException { TransactionManager transactionManager = owner.getProvider().getTransactionManager(); try { transactionManager.resume(transaction); } catch (InvalidTransactionException e) { // should be impossible throw Log.log.invalidTxnState(); } final Transaction transactionManagerTransaction = transactionManager.getTransaction(); if (! transaction.equals(transactionManagerTransaction)) { throw Log.log.unexpectedProviderTransactionMismatch(transaction, transactionManagerTransaction); } notifyAssociationListeners(true); }
public void rollback() throws IllegalStateException, SystemException { if (isImported()) { throw Log.log.rollbackOnImported(); } try { owner.getProvider().rollbackLocal(transaction); } finally { final XAOutflowedResources outflowedResources = RemoteTransactionContext.getOutflowedResources(this); if (outflowedResources == null || outflowedResources.getEnlistedSubordinates() == 0) { // we can drop the mapping, since we are both a master and have no enlisted subordinates owner.getProvider().dropLocal(transaction); } } }
void rollbackAndDissociate() throws IllegalStateException, SystemException { if (isImported()) { throw Log.log.rollbackOnImported(); } notifyAssociationListeners(false); try { owner.getProvider().getTransactionManager().rollback(); } finally { final XAOutflowedResources outflowedResources = RemoteTransactionContext.getOutflowedResources(this); if (outflowedResources == null || outflowedResources.getEnlistedSubordinates() == 0) { // we can drop the mapping, since we are both a master and have no enlisted subordinates owner.getProvider().dropLocal(transaction); } } }
void commitAndDissociate() throws RollbackException, HeuristicMixedException, HeuristicRollbackException, SecurityException, SystemException { if (isImported()) { throw Log.log.commitOnImported(); } notifyAssociationListeners(false); try { owner.getProvider().getTransactionManager().commit(); } catch (RollbackException re) { addRollbackExceptions(re); throw re; } finally { final XAOutflowedResources outflowedResources = RemoteTransactionContext.getOutflowedResources(this); if (outflowedResources == null || outflowedResources.getEnlistedSubordinates() == 0) { // we can drop the mapping, since we are both a master and have no enlisted subordinates owner.getProvider().dropLocal(transaction); } } }
public void commit() throws RollbackException, HeuristicMixedException, HeuristicRollbackException, SecurityException, SystemException { if (isImported()) { throw Log.log.commitOnImported(); } try { owner.getProvider().commitLocal(transaction); } catch (RollbackException re) { addRollbackExceptions(re); throw re; } finally { final XAOutflowedResources outflowedResources = RemoteTransactionContext.getOutflowedResources(this); if (outflowedResources == null || outflowedResources.getEnlistedSubordinates() == 0) { // we can drop the mapping, since we are both a master and have no enlisted subordinates owner.getProvider().dropLocal(transaction); } } }