private static SysExTry whileResumed(AbstractTransaction transaction) throws SystemException { if (transaction == null) { return AbstractTransaction::doNothing; } final ContextTransactionManager tm = ContextTransactionManager.INSTANCE; tm.resume(transaction); return tm::suspend; }
private static SysExTry whileSuspended() throws SystemException { final ContextTransactionManager tm = ContextTransactionManager.INSTANCE; final AbstractTransaction suspended = tm.suspend(); return suspended == null ? AbstractTransaction::doNothing : () -> tm.resume(suspended); }
private void safeResume(final Transaction tx, final Throwable t) { try { ContextTransactionManager.getInstance().resume(tx); } catch (Exception e) { t.addSuppressed(e); } }
public void resume(final Transaction transaction) throws InvalidTransactionException, IllegalStateException, SystemException { if (transaction != null && ! (transaction instanceof AbstractTransaction)) { throw Log.log.notSupportedTransaction(transaction); } resume((AbstractTransaction) transaction); }
private void safeResume(final Transaction tx) { try { ContextTransactionManager.getInstance().resume(tx); } catch (Exception e) { throw new EJBException(e); } }
void begin(CreationListener.CreatedBy createdBy) throws NotSupportedException, SystemException { final State state = stateRef.get(); if (state.transaction != null) { throw Log.log.nestedNotSupported(); } resume(LocalTransactionContext.getCurrent().beginTransaction(state.getTimeout(), false, createdBy)); }
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 SessionID handleSessionCreation(EJBSessionCreationInvocationContext context) throws Exception { AbstractTransaction transaction = context.getTransaction(); // While session requests currently only utilize the caller thread, // this will support any future use of a worker. Additionally hides // TX from other interceptors, providing consistency with standard // invocation handling. if (transaction == null) { transaction = transactionManager.getTransaction(); context.setTransaction(transaction); } setupStickinessIfRequired(context, true, transaction); Transaction old = transactionManager.suspend(); try { return context.proceed(); } finally { transactionManager.resume(old); } }
/** * <p> * Start work gets imported transaction and assign it to current thread. * <p> * This method mimics behavior of Narayana's {@link JBossXATerminator}. */ @Override public void startWork(Work work, Xid xid) throws WorkCompletedException { LocalTransaction transaction = null; try { ImportResult<LocalTransaction> transactionImportResult = localTransactionContext.findOrImportTransaction(xid, 0); transaction = transactionImportResult.getTransaction(); ContextTransactionManager.getInstance().resume(transaction); } catch (XAException xae) { throw TransactionLogger.ROOT_LOGGER.cannotFindOrImportInflowTransaction(xid, work, xae); } catch (InvalidTransactionException ite) { throw TransactionLogger.ROOT_LOGGER.importedInflowTransactionIsInactive(xid, work, ite); } catch (SystemException se) { throw TransactionLogger.ROOT_LOGGER.cannotResumeInflowTransactionUnexpectedError(transaction, work, se); } }
public void handleInvocation(final EJBClientInvocationContext context) throws Exception { final ClientTransactionPolicy transactionPolicy = context.getTransactionPolicy(); AbstractTransaction transaction = context.getTransaction(); // Always prefer the context TX, as the caller TX might be wrong // (e.g. retries happen in worker thread, not caller thread) if (transaction == null) { transaction = transactionManager.getTransaction(); } setupStickinessIfRequired(context, transactionPolicy.propagate(), transaction); if (transactionPolicy.failIfTransactionAbsent()) { if (transaction == null) { throw Logs.TXN.txNotActiveForThread(); } } if (transactionPolicy.failIfTransactionPresent()) { if (transaction != null) { throw Logs.TXN.txAlreadyAssociatedWithThread(); } } if (transactionPolicy.propagate()) { context.setTransaction(transaction); } // Hide any caller TX from other interceptors Transaction old = transactionManager.suspend(); try { context.sendRequest(); } finally { transactionManager.resume(old); } }
private static SysExTry whileResumed(AbstractTransaction transaction) throws SystemException { if (transaction == null) { return AbstractTransaction::doNothing; } final ContextTransactionManager tm = ContextTransactionManager.INSTANCE; tm.resume(transaction); return tm::suspend; }
private static SysExTry whileResumed(AbstractTransaction transaction) throws SystemException { if (transaction == null) { return AbstractTransaction::doNothing; } final ContextTransactionManager tm = ContextTransactionManager.INSTANCE; tm.resume(transaction); return tm::suspend; }
public void resume(final Transaction transaction) throws InvalidTransactionException, IllegalStateException, SystemException { if (transaction != null && ! (transaction instanceof AbstractTransaction)) { throw Log.log.notSupportedTransaction(transaction); } resume((AbstractTransaction) transaction); }
private static SysExTry whileSuspended() throws SystemException { final ContextTransactionManager tm = ContextTransactionManager.INSTANCE; final AbstractTransaction suspended = tm.suspend(); return suspended == null ? AbstractTransaction::doNothing : () -> tm.resume(suspended); }
private static SysExTry whileSuspended() throws SystemException { final ContextTransactionManager tm = ContextTransactionManager.INSTANCE; final AbstractTransaction suspended = tm.suspend(); return suspended == null ? AbstractTransaction::doNothing : () -> tm.resume(suspended); }
public void resume(final Transaction transaction) throws InvalidTransactionException, IllegalStateException, SystemException { if (transaction != null && ! (transaction instanceof AbstractTransaction)) { throw Log.log.notSupportedTransaction(transaction); } resume((AbstractTransaction) transaction); }
void begin(CreationListener.CreatedBy createdBy) throws NotSupportedException, SystemException { final State state = stateRef.get(); if (state.transaction != null) { throw Log.log.nestedNotSupported(); } resume(LocalTransactionContext.getCurrent().beginTransaction(state.getTimeout(), false, createdBy)); }
void begin(CreationListener.CreatedBy createdBy) throws NotSupportedException, SystemException { final State state = stateRef.get(); if (state.transaction != null) { throw Log.log.nestedNotSupported(); } resume(LocalTransactionContext.getCurrent().beginTransaction(state.getTimeout(), false, createdBy)); }
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)); }
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)); }