throw new NotSupportedException(); throw new NotSupportedException();
@Override public final NotSupportedException txAlreadyAssociatedWithThread() { final NotSupportedException result = new NotSupportedException(String.format(getLoggingLocale(), txAlreadyAssociatedWithThread$str())); final StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(Arrays.copyOfRange(st, 1, st.length)); return result; } private static final String noTxAssociatedWithThread = "EJBCLIENT000047: A transaction is not associated with this thread";
@Override public final NotSupportedException nestedNotSupported() { final NotSupportedException result = new NotSupportedException(String.format(getLoggingLocale(), nestedNotSupported$str())); final StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(Arrays.copyOfRange(st, 1, st.length)); return result; } private static final String notSupportedTransaction = "WFTXN0002: Transaction is not a supported instance: %s";
if (VERBOSE) log.fine(exception); throw new NotSupportedException(exception);
@Test public void jtaTransactionManagerWithNotSupportedExceptionOnNestedBegin() throws Exception { UserTransaction ut = mock(UserTransaction.class); given(ut.getStatus()).willReturn(Status.STATUS_ACTIVE); willThrow(new NotSupportedException("not supported")).given(ut).begin(); try { JtaTransactionManager ptm = newJtaTransactionManager(ut); TransactionTemplate tt = new TransactionTemplate(ptm); tt.setPropagationBehavior(TransactionDefinition.PROPAGATION_NESTED); tt.execute(new TransactionCallbackWithoutResult() { @Override protected void doInTransactionWithoutResult(TransactionStatus status) { // something transactional } }); fail("Should have thrown NestedTransactionNotSupportedException"); } catch (NestedTransactionNotSupportedException ex) { // expected } }
public TransactionXid compensableBegin() throws NotSupportedException, SystemException { RemoteCoordinator compensableCoordinator = (RemoteCoordinator) this.beanFactory.getCompensableNativeParticipant(); CompensableManager tompensableManager = this.beanFactory.getCompensableManager(); XidFactory compensableXidFactory = this.beanFactory.getCompensableXidFactory(); CompensableTransactionImpl compensable = (CompensableTransactionImpl) tompensableManager .getCompensableTransactionQuietly(); if (compensable != null) { throw new NotSupportedException(); } TransactionXid compensableXid = compensableXidFactory.createGlobalXid(); TransactionContext compensableContext = new TransactionContext(); compensableContext.setCoordinator(true); compensableContext.setPropagated(true); compensableContext.setCompensable(true); compensableContext.setStatefully(this.statefully); compensableContext.setXid(compensableXid); compensableContext.setPropagatedBy(compensableCoordinator.getIdentifier()); compensable = new CompensableTransactionImpl(compensableContext); compensable.setBeanFactory(this.beanFactory); try { compensableCoordinator.start(compensableContext, XAResource.TMNOFLAGS); } catch (XAException ex) { logger.error("Error occurred while beginning an compensable transaction!", ex); throw new SystemException(ex.getMessage()); } return compensableXid; }
@Override public void begin() throws NotSupportedException, SystemException { if (log.isDebugEnabled()) log.info("beginning JTA transaction"); Transaction tx = threadLocal.get(); if (tx != null) { if ((tx.getStatus() == Status.STATUS_MARKED_ROLLBACK)) { throw new NotSupportedException("Nested Transaction not supported!"); } } Integer timer = timerThead.get(); threadLocal.set(new KunderaTransaction(timer != null ? timer : DEFAULT_TIME_OUT)); }
public void compensableBegin() throws NotSupportedException, SystemException { if (this.getCompensableTransactionQuietly() != null) { throw new NotSupportedException();
protected void applyTimeout(JiniTransactionObject txObject, int timeout) throws NotSupportedException { // TODO: maybe use a LeaseRenewalManager if (timeout != TransactionDefinition.TIMEOUT_DEFAULT) { throw new NotSupportedException( "JiniTransactionManager does not support custom timeouts"); } }
private void assertNotActive() throws NotSupportedException { if ( isEntityManagerSet() ) { throw new NotSupportedException("transaction is already active"); } }
private void assertNotActive() throws NotSupportedException { //TODO: translate exceptions that occur into the correct JTA exception if ( isSessionSet() ) { throw new NotSupportedException("transaction is already active"); } }
public void begin() throws NotSupportedException { if (threadTransaction.get() != null) { throw new NotSupportedException("A transaction is already active"); } final MyTransaction tx = new MyTransaction(); threadTransaction.set(tx); }
public void begin() throws NotSupportedException { if (threadTransaction.get() != null) { throw new NotSupportedException("A transaction is already active"); } MyTransaction tx = new MyTransaction(); threadTransaction.set(tx); }
@Override public void begin() throws NotSupportedException, SystemException { if (hasActiveTransaction()) { throw new NotSupportedException("Nested transactions are not supported"); } ACTIVE_TRANSACTION.set(Optional.of(new LocalTransaction())); }
/* package */static void begin() throws NotSupportedException { if (getTransaction() != null) { throw new NotSupportedException("Nested transactions are not supported"); } transaction.set(new SimpleTransaction()); }
/** * <P> * RegistryManagedRuntime cannot suspend transactions. * </P> */ public void doNonTransactionalWork(Runnable runnable) throws NotSupportedException { throw new NotSupportedException(_loc.get("tsr-cannot-suspend") .getMessage()); } }
@Override public void begin() throws NotSupportedException, SystemException { Transaction currentTx = getTransaction(); if (currentTx != null) { throw new NotSupportedException( Thread.currentThread() + " is already associated with a transaction (" + currentTx + ")"); } associateTransaction(createTransaction()); }
@Override public final NotSupportedException txAlreadyAssociatedWithThread() { final NotSupportedException result = new NotSupportedException(String.format(getLoggingLocale(), txAlreadyAssociatedWithThread$str())); final StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(Arrays.copyOfRange(st, 1, st.length)); return result; } private static final String noTxAssociatedWithThread = "EJBCLIENT000047: A transaction is not associated with this thread";
@Override public final NotSupportedException nestedNotSupported() { final NotSupportedException result = new NotSupportedException(String.format(getLoggingLocale(), nestedNotSupported$str())); final StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(Arrays.copyOfRange(st, 1, st.length)); return result; } private static final String notSupportedTransaction = "WFTXN0002: Transaction is not a supported instance: %s";
@Override public void begin() throws NotSupportedException, SystemException { if (getStatus() != Status.STATUS_NO_TRANSACTION && getStatus() != Status.STATUS_ROLLEDBACK && getStatus() != Status.STATUS_COMMITTED) { throw new NotSupportedException("UserTransaction already started"); } new SimulatedTransactionManager().push(); }