/** * Get a {@code UserTransaction} object instance which can be used to control transactions on a specific node. * * @param targetNodeName the node name (ignored) * @return the {@code UserTransaction} instance * @throws IllegalStateException if the transaction context isn't set or cannot provide a {@code UserTransaction} instance */ @Deprecated @SuppressWarnings("unused") public static UserTransaction getUserTransaction(String targetNodeName) { return RemoteTransactionContext.getInstance().getUserTransaction(); }
} else if (transaction instanceof LocalTransaction) { final LocalTransaction localTransaction = (LocalTransaction) transaction; final XAOutflowHandle outflowHandle = transactionContext.outflowTransaction(uri, localTransaction); final Xid xid = outflowHandle.getXid(); dataOutput.writeByte(2);
CONTEXT_MANAGER.setGlobalDefault(new RemoteTransactionContext(RemoteTransactionContext.class.getClassLoader())); return null; }); return getUserTransaction();
private RemoteTransactionProvider getProvider() { return RemoteTransactionContext.getInstancePrivate().getProvider(location); }
public void begin() throws NotSupportedException, SystemException { final ContextTransactionManager transactionManager = ContextTransactionManager.getInstance(); if (transactionManager.getTransaction() != null) { throw Log.log.nestedNotSupported(); } final RemoteTransactionContext context = RemoteTransactionContext.getInstancePrivate(); int timeout = stateRef.get().timeout; if (timeout == 0) timeout = ContextTransactionManager.getGlobalDefaultTransactionTimeout(); transactionManager.resume(context.notifyCreationListeners(new RemoteTransaction(authenticationContext, timeout), CreationListener.CreatedBy.USER_TRANSACTION)); }
@Override public RemoteTransactionContext run() { return RemoteTransactionContext.getInstance(); } });
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); } } }
/** {@inheritDoc} */ public ContextManager<RemoteTransactionContext> getInstanceContextManager() { return getContextManager(); }
Object readResolve() { AuthenticationContext context = AuthenticationContext.captureCurrent(); final NamingProvider currentNamingProvider = NamingProvider.getCurrentNamingProvider(); if (currentNamingProvider != null) { final ProviderEnvironment providerEnvironment = currentNamingProvider.getProviderEnvironment(); context = providerEnvironment.getAuthenticationContextSupplier().get(); } return context.runFunction(RemoteTransactionContext::getUserTransaction, RemoteTransactionContext.getInstancePrivate()); } }
final RemoteTransactionContext context = RemoteTransactionContext.getInstancePrivate(); final RemoteTransactionProvider provider = context.getProvider(location); if (provider == null) { throw Log.log.noProviderForUri(location);
HttpEJBReceiver() { if(System.getSecurityManager() == null) { transactionContext = RemoteTransactionContext.getInstance(); } else { transactionContext = AccessController.doPrivileged(new PrivilegedAction<RemoteTransactionContext>() { @Override public RemoteTransactionContext run() { return RemoteTransactionContext.getInstance(); } }); } }
/** * Outflow the given local transaction to the given location. The returned handle * must be used to confirm or forget the enlistment attempt either immediately or at some point in the future; * failure to do so may cause the transaction to be rolled back with an error. * * @param location the location to outflow to (must not be {@code null}) * @param transaction the transaction (must not be {@code null}) * @return the enlistment handle (not {@code null}) * @throws SystemException if the transaction manager fails for some reason * @throws RollbackException if the transaction has been rolled back in the meantime * @throws IllegalStateException if no transaction is active * @throws UnsupportedOperationException if the provider for the location does not support outflow */ public XAOutflowHandle outflowTransaction(final URI location, final LocalTransaction transaction) throws SystemException, IllegalStateException, UnsupportedOperationException, RollbackException { Assert.checkNotNullParam("location", location); Assert.checkNotNullParam("transaction", transaction); XAOutflowedResources outflowedResources = getOutflowedResources(transaction); if (outflowedResources == null) { synchronized (transaction.getOutflowLock()) { outflowedResources = getOutflowedResources(transaction); if (outflowedResources == null) { transaction.putResource(outflowKey, outflowedResources = new XAOutflowedResources(transaction)); } } } SubordinateXAResource resource = outflowedResources.getOrEnlist(location, transaction.getParentName()); return resource.addHandle(resource.getXid()); }
public void begin() throws NotSupportedException, SystemException { final ContextTransactionManager transactionManager = ContextTransactionManager.getInstance(); if (transactionManager.getTransaction() != null) { throw Log.log.nestedNotSupported(); } final RemoteTransactionContext context = RemoteTransactionContext.getInstancePrivate(); int timeout = stateRef.get().timeout; if (timeout == 0) timeout = ContextTransactionManager.getGlobalDefaultTransactionTimeout(); transactionManager.resume(context.notifyCreationListeners(new RemoteTransaction(authenticationContext, timeout), CreationListener.CreatedBy.USER_TRANSACTION)); }
/** * Get the active remote transaction context instance. * * @return the remote transaction context instance (not {@code null}) */ public static RemoteTransactionContext getInstance() { return getContextManager().get(); }
Object readResolve() { AuthenticationContext context = AuthenticationContext.captureCurrent(); final NamingProvider currentNamingProvider = NamingProvider.getCurrentNamingProvider(); if (currentNamingProvider != null) { final ProviderEnvironment providerEnvironment = currentNamingProvider.getProviderEnvironment(); context = providerEnvironment.getAuthenticationContextSupplier().get(); } return context.runFunction(RemoteTransactionContext::getUserTransaction, RemoteTransactionContext.getInstancePrivate()); } }
/** * Get a {@code UserTransaction} object instance which can be used to control transactions on a specific node. * * @param targetNodeName the node name (ignored) * @return the {@code UserTransaction} instance * @throws IllegalStateException if the transaction context isn't set or cannot provide a {@code UserTransaction} instance */ @Deprecated @SuppressWarnings("unused") public static UserTransaction getUserTransaction(String targetNodeName) { return RemoteTransactionContext.getInstance().getUserTransaction(); }
private RemoteTransactionProvider getProvider() { return RemoteTransactionContext.getInstancePrivate().getProvider(location); }
private RemoteUserTransaction getRemoteUserTransaction() { AuthenticationContext context = providerEnvironment.getAuthenticationContextSupplier().get(); return context.runFunction(RemoteTransactionContext::getUserTransaction, RemoteTransactionContext.getInstance()); }
CONTEXT_MANAGER.setGlobalDefault(new RemoteTransactionContext(RemoteTransactionContext.class.getClassLoader())); return null; }); return getUserTransaction();
} else if (transaction instanceof LocalTransaction) { final LocalTransaction localTransaction = (LocalTransaction) transaction; final XAOutflowHandle outflowHandle = transactionContext.outflowTransaction(location, localTransaction); final Xid xid = outflowHandle.getXid(); dataOutput.writeByte(2);