Refine search
throw new SystemException( "TransactionManager invalid"); if (VERBOSE) log.fine(exception); throw new NotSupportedException(exception); log.severe(String.format("SystemException due to %s", new Object[] {e})); throw new SystemException(exception);
@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";
public TransactionImple createSubordinate () throws javax.transaction.NotSupportedException, javax.transaction.SystemException { if (jtaLogger.logger.isTraceEnabled()) { jtaLogger.logger.trace("BaseTransaction.createSubordinate"); } try { checkTransactionState(); } catch (IllegalStateException e1) { NotSupportedException notSupportedException = new NotSupportedException(); notSupportedException.initCause(e1); throw notSupportedException; } catch (Exception e2) { javax.transaction.SystemException systemException = new javax.transaction.SystemException(e2.toString()); systemException.initCause(e2); throw systemException; } Integer value = _timeouts.get(); int v = 0; // if not set then assume 0. What else can we do? if (value != null) { v = value.intValue(); } // TODO set default timeout return new com.arjuna.ats.internal.jta.transaction.arjunacore.subordinate.TransactionImple(v); }
throw new NotSupportedException(); throw new NotSupportedException();
public Transaction begin(long transactionTimeoutMilliseconds) throws NotSupportedException, SystemException { if (getStatus() != Status.STATUS_NO_TRANSACTION) { throw new NotSupportedException("Nested Transactions are not supported"); } TransactionImpl tx = new TransactionImpl(xidFactory, transactionLog, getTransactionTimeoutMilliseconds(transactionTimeoutMilliseconds)); // timeoutTimer.schedule(tx, getTransactionTimeoutMilliseconds(transactionTimeoutMilliseconds)); try { associate(tx); } catch (InvalidTransactionException e) { // should not be possible since we just created that transaction and no one has a reference yet throw (SystemException)new SystemException("Internal error: associate threw an InvalidTransactionException for a newly created transaction").initCause(e); } // Todo: Verify if this is correct thing to do. Use default timeout for next transaction. this.transactionTimeoutMilliseconds.set(null); return tx; }
@Override public void checkTMState() throws NotSupportedException { if (tc.isEntryEnabled()) Tr.entry(tc, "checkTMState"); if (_state != TMService.TMStates.ACTIVE) { if (_state == TMService.TMStates.RECOVERING) { // Check that the initial phase of recovery is complete } else if (_state == TMService.TMStates.INACTIVE) { try { TMHelper.start(); } catch (Exception e) { final NotSupportedException nse = new NotSupportedException(); nse.initCause(e); throw nse; } } else if (_state == TMService.TMStates.STOPPING) { throw new NotSupportedException("JTM is stopping"); } else if (_state == TMService.TMStates.STOPPED) { throw new NotSupportedException("JTM is stopped"); } } if (tc.isEntryEnabled()) Tr.exit(tc, "checkTMState"); }
/** * Method to test positive scenario: A) begin transaction. B) assertion on * invocation of commit method. */ @Test public void testInitializeViaLookup() { try { Assert.assertNotNull(utx); Assert.assertSame(KunderaJTAUserTransaction.class, utx.getClass()); utx.begin(); Assert.assertEquals(Status.STATUS_ACTIVE, utx.getStatus()); // pass true, as transaction has already begun. assertOnCommit(utx, true); } catch (NotSupportedException nsuex) { Assert.fail(nsuex.getMessage()); } catch (SystemException ex) { Assert.fail(ex.getMessage()); } }
nse.getLocalizedMessage()); sqlEx.initCause(nse); throw sqlEx;
@Test public void test() throws Exception { TransactionManager tm = com.arjuna.ats.jta.TransactionManager.transactionManager(); tm.begin(); Transaction tx = tm.getTransaction(); tx.commit(); assertEquals(Status.STATUS_COMMITTED, tm.getStatus()); try { tm.begin(); fail("Begin call completed successfully - this shouldn't have happened"); } catch (NotSupportedException e) { System.out.println("NotSupportedException \""+e.getMessage()+"\" occurred this is expected and correct"); } } }
public TransactionImple createSubordinate () throws javax.transaction.NotSupportedException, javax.transaction.SystemException { if (jtaLogger.logger.isTraceEnabled()) { jtaLogger.logger.trace("BaseTransaction.createSubordinate"); } try { checkTransactionState(); } catch (IllegalStateException e1) { NotSupportedException notSupportedException = new NotSupportedException(); notSupportedException.initCause(e1); throw notSupportedException; } catch (Exception e2) { javax.transaction.SystemException systemException = new javax.transaction.SystemException(e2.toString()); systemException.initCause(e2); throw systemException; } Integer value = _timeouts.get(); int v = 0; // if not set then assume 0. What else can we do? if (value != null) { v = value.intValue(); } // TODO set default timeout return new com.arjuna.ats.internal.jta.transaction.arjunacore.subordinate.TransactionImple(v); }
@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 Transaction begin(long transactionTimeoutMilliseconds) throws NotSupportedException, SystemException { if (getStatus() != Status.STATUS_NO_TRANSACTION) { throw new NotSupportedException("Nested Transactions are not supported"); } TransactionImpl tx = new TransactionImpl(xidFactory, transactionLog, getTransactionTimeoutMilliseconds(transactionTimeoutMilliseconds)); // timeoutTimer.schedule(tx, getTransactionTimeoutMilliseconds(transactionTimeoutMilliseconds)); try { associate(tx); } catch (InvalidTransactionException e) { // should not be possible since we just created that transaction and no one has a reference yet throw (SystemException)new SystemException("Internal error: associate threw an InvalidTransactionException for a newly created transaction").initCause(e); } // Todo: Verify if this is correct thing to do. Use default timeout for next transaction. this.transactionTimeoutMilliseconds.set(null); return tx; }
/** * Delegate nonTransactional work to the appropriate managed runtime. If no * managed runtime is found then delegate {@link AbstractManagedRuntime}. */ public void doNonTransactionalWork(Runnable runnable) throws NotSupportedException { // Obtain a transaction manager to initialize the runtime. try { getTransactionManager(); } catch (Exception e) { NotSupportedException nse = new NotSupportedException(_loc .get("tm-unavailable", _runtime).getMessage()); nse.initCause(e); throw nse; } _runtime.doNonTransactionalWork(runnable); } }
@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";
Assert.fail(nsuex.getMessage()); Assert.fail(ex.getMessage());
nse.getLocalizedMessage()); sqlEx.initCause(nse); throw sqlEx;
public TransactionImple createSubordinate () throws javax.transaction.NotSupportedException, javax.transaction.SystemException { if (jtaLogger.logger.isTraceEnabled()) { jtaLogger.logger.trace("BaseTransaction.createSubordinate"); } try { checkTransactionState(); } catch (IllegalStateException e1) { NotSupportedException notSupportedException = new NotSupportedException(); notSupportedException.initCause(e1); throw notSupportedException; } catch (Exception e2) { javax.transaction.SystemException systemException = new javax.transaction.SystemException(e2.toString()); systemException.initCause(e2); throw systemException; } Integer value = _timeouts.get(); int v = 0; // if not set then assume 0. What else can we do? if (value != null) { v = value.intValue(); } // TODO set default timeout return new com.arjuna.ats.internal.jta.transaction.arjunacore.subordinate.TransactionImple(v); }
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 Transaction begin(long transactionTimeoutMilliseconds) throws NotSupportedException, SystemException { if (getStatus() != Status.STATUS_NO_TRANSACTION) { throw new NotSupportedException("Nested Transactions are not supported"); } TransactionImpl tx = new TransactionImpl(this, getTransactionTimeoutMilliseconds(transactionTimeoutMilliseconds)); // timeoutTimer.schedule(tx, getTransactionTimeoutMilliseconds(transactionTimeoutMilliseconds)); try { associate(tx); } catch (InvalidTransactionException e) { // should not be possible since we just created that transaction and no one has a reference yet throw (SystemException)new SystemException("Internal error: associate threw an InvalidTransactionException for a newly created transaction").initCause(e); } // Todo: Verify if this is correct thing to do. Use default timeout for next transaction. this.transactionTimeoutMilliseconds.set(null); return tx; }