public int getTransactionStatus() { try { return ContextTransactionManager.getInstance().getStatus(); } catch (SystemException e) { return Status.STATUS_UNKNOWN; } }
/** * @return Returns the current transaction, if any. Else returns null. * @throws javax.ejb.EJBException If there is any system level exception */ protected Transaction getTransaction() { return ContextTransactionManager.getInstance().getTransaction(); }
private void safeSuspend(final Throwable t) { try { ContextTransactionManager.getInstance().suspend(); } catch (SystemException e) { t.addSuppressed(e); } }
private void safeResume(final Transaction tx, final Throwable t) { try { ContextTransactionManager.getInstance().resume(tx); } catch (Exception e) { t.addSuppressed(e); } }
public void setRollbackOnly() throws IllegalStateException { try { ContextTransactionManager.getInstance().setRollbackOnly(); } catch (SystemException e) { // ignored } }
public void setAvailability(boolean available) { final SecurityManager sm = System.getSecurityManager(); if (sm != null) { sm.checkPermission(TransactionPermission.forName("modifyUserTransactionAvailability")); } ContextTransactionManager.getInstance().setAvailable(available); }
public void begin() throws NotSupportedException, SystemException { checkTransactionStateAvailability(); ContextTransactionManager.getInstance().begin(CreationListener.CreatedBy.USER_TRANSACTION); }
public void commit() throws RollbackException, HeuristicMixedException, HeuristicRollbackException, SecurityException, IllegalStateException, SystemException { checkTransactionStateAvailability(); ContextTransactionManager.getInstance().commit(); }
private void safeResume(final Transaction tx) { try { ContextTransactionManager.getInstance().resume(tx); } catch (Exception e) { throw new EJBException(e); } }
public Object getResource(final Object key) throws IllegalStateException { final AbstractTransaction transaction = ContextTransactionManager.getInstance().getStateRef().get().transaction; if (transaction == null) { throw Log.log.noTransaction(); } return transaction.getResource(key); }
public void putResource(final Object key, final Object value) throws IllegalStateException { final AbstractTransaction transaction = ContextTransactionManager.getInstance().getStateRef().get().transaction; if (transaction == null) { throw Log.log.noTransaction(); } transaction.putResource(key, value); } }
public boolean getRollbackOnly() throws IllegalStateException { final AbstractTransaction transaction = ContextTransactionManager.getInstance().getStateRef().get().transaction; if (transaction == null) { throw Log.log.noTransaction(); } return transaction.getRollbackOnly(); }
public void commit() throws RollbackException, HeuristicMixedException, HeuristicRollbackException, SecurityException, IllegalStateException, SystemException { ContextTransactionManager transactionManager = ContextTransactionManager.getInstance(); final RemoteTransaction remoteTransaction = getMatchingTransaction(); if (remoteTransaction == null) { throw Log.log.invalidTxnState(); } else { transactionManager.commit(); } }
/** * Check if a persistent timer is already executed from a different instance * or should be executed. * For non-persistent timer it always return <code>true</code>. * * @param timer the timer which should be checked * @return <code>true</code> if the timer is not persistent or the persistent timer should start */ public boolean shouldRun(TimerImpl timer) { // check peristent without further check to prevent from Exception (WFLY-6152) return !timer.isTimerPersistent() || timerPersistence.getValue().shouldRun(timer, ContextTransactionManager.getInstance()); }
public void rollback() throws IllegalStateException, SecurityException, SystemException { ContextTransactionManager transactionManager = ContextTransactionManager.getInstance(); final RemoteTransaction remoteTransaction = getMatchingTransaction(); if (remoteTransaction == null) { throw Log.log.invalidTxnState(); } else { transactionManager.rollback(); } }
public void setRollbackOnly() throws IllegalStateException, SystemException { ContextTransactionManager transactionManager = ContextTransactionManager.getInstance(); final RemoteTransaction remoteTransaction = getMatchingTransaction(); if (remoteTransaction == null) { throw Log.log.noTransaction(); } else { transactionManager.setRollbackOnly(); } }
protected Object never(InterceptorContext invocation, final EJBComponent component) throws Exception { final ContextTransactionManager tm = ContextTransactionManager.getInstance(); if (tm.getTransaction() != null || invocation.hasTransaction()) { throw EjbLogger.ROOT_LOGGER.txPresentForNeverTxAttribute(); } return invokeInNoTx(invocation, component); }
protected Object supports(InterceptorContext invocation, final EJBComponent component) throws Exception { final ContextTransactionManager tm = ContextTransactionManager.getInstance(); Transaction tx = tm.getTransaction(); if (tx == null) { if (invocation.hasTransaction()) { return invokeInImportedTx(invocation, component); } return invokeInNoTx(invocation, component); } else { return invokeInCallerTx(invocation, tx, component); } } }
protected Object mandatory(InterceptorContext invocation, final EJBComponent component) throws Exception { final ContextTransactionManager tm = ContextTransactionManager.getInstance(); Transaction tx = tm.getTransaction(); if (tx == null) { if (invocation.hasTransaction()) { return invokeInImportedTx(invocation, component); } throw EjbLogger.ROOT_LOGGER.txRequiredForInvocation(invocation); } return invokeInCallerTx(invocation, tx, component); }
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)); }