@Override public int getTimeout() { return this.targetDefinition.getTimeout(); }
/** * Determine the actual timeout to use for the given definition. * Will fall back to this manager's default timeout if the * transaction definition doesn't specify a non-default value. * @param definition the transaction definition * @return the actual timeout to use * @see org.springframework.transaction.TransactionDefinition#getTimeout() * @see #setDefaultTimeout */ protected int determineTimeout(TransactionDefinition definition) { if (definition.getTimeout() != TransactionDefinition.TIMEOUT_DEFAULT) { return definition.getTimeout(); } return this.defaultTimeout; }
@Override public int getTimeout() { return this.targetDefinition.getTimeout(); }
/** * Determine the actual timeout to use for the given definition. * Will fall back to this manager's default timeout if the * transaction definition doesn't specify a non-default value. * @param definition the transaction definition * @return the actual timeout to use * @see org.springframework.transaction.TransactionDefinition#getTimeout() * @see #setDefaultTimeout */ protected int determineTimeout(TransactionDefinition definition) { if (definition.getTimeout() != TransactionDefinition.TIMEOUT_DEFAULT) { return definition.getTimeout(); } return this.defaultTimeout; }
/** * Copy constructor. Definition can be modified through bean property setters. * @see #setPropagationBehavior * @see #setIsolationLevel * @see #setTimeout * @see #setReadOnly * @see #setName */ public DefaultTransactionDefinition(TransactionDefinition other) { this.propagationBehavior = other.getPropagationBehavior(); this.isolationLevel = other.getIsolationLevel(); this.timeout = other.getTimeout(); this.readOnly = other.isReadOnly(); this.name = other.getName(); }
if (definition.getTimeout() != TransactionDefinition.TIMEOUT_DEFAULT) { session.getTransaction().setTimeout(definition.getTimeout());
/** * Copy constructor. Definition can be modified through bean property setters. * @see #setPropagationBehavior * @see #setIsolationLevel * @see #setTimeout * @see #setReadOnly * @see #setName */ public DefaultTransactionDefinition(TransactionDefinition other) { this.propagationBehavior = other.getPropagationBehavior(); this.isolationLevel = other.getIsolationLevel(); this.timeout = other.getTimeout(); this.readOnly = other.isReadOnly(); this.name = other.getName(); }
if (definition.getTimeout() < TransactionDefinition.TIMEOUT_DEFAULT) { throw new InvalidTimeoutException("Invalid transaction timeout", definition.getTimeout()); UOWActionAdapter<T> action = null; try { if (definition.getTimeout() > TransactionDefinition.TIMEOUT_DEFAULT) { uowManager.setUOWTimeout(uowType, definition.getTimeout());
if (definition.getTimeout() < TransactionDefinition.TIMEOUT_DEFAULT) { throw new InvalidTimeoutException("Invalid transaction timeout", definition.getTimeout());
if (definition.getTimeout() != TransactionDefinition.TIMEOUT_DEFAULT) { session.getTransaction().setTimeout(definition.getTimeout());
if (definition.getTimeout() < TransactionDefinition.TIMEOUT_DEFAULT) { throw new InvalidTimeoutException("Invalid transaction timeout", definition.getTimeout()); UOWActionAdapter<T> action = null; try { if (definition.getTimeout() > TransactionDefinition.TIMEOUT_DEFAULT) { uowManager.setUOWTimeout(uowType, definition.getTimeout());
if (definition.getTimeout() < TransactionDefinition.TIMEOUT_DEFAULT) { throw new InvalidTimeoutException("Invalid transaction timeout", definition.getTimeout());
/** {@inheritDoc} */ @Override protected void doBegin(Object transaction, TransactionDefinition definition) throws TransactionException { if (definition.getIsolationLevel() == TransactionDefinition.ISOLATION_READ_UNCOMMITTED) throw new InvalidIsolationLevelException("Ignite does not support READ_UNCOMMITTED isolation level."); IgniteTransactionObject txObj = (IgniteTransactionObject)transaction; Transaction tx = null; try { if (txObj.getTransactionHolder() == null || txObj.getTransactionHolder().isSynchronizedWithTransaction()) { long timeout = ignite.configuration().getTransactionConfiguration().getDefaultTxTimeout(); if (definition.getTimeout() > 0) timeout = TimeUnit.SECONDS.toMillis(definition.getTimeout()); Transaction newTx = ignite.transactions().txStart(transactionConcurrency, convertToIgniteIsolationLevel(definition.getIsolationLevel()), timeout, 0); if (log.isDebugEnabled()) log.debug("Started Ignite transaction: " + newTx); txObj.setTransactionHolder(new IgniteTransactionHolder(newTx), true); } txObj.getTransactionHolder().setSynchronizedWithTransaction(true); txObj.getTransactionHolder().setTransactionActive(true); tx = txObj.getTransactionHolder().getTransaction(); // Bind the session holder to the thread. if (txObj.isNewTransactionHolder()) TransactionSynchronizationManager.bindResource(this.ignite, txObj.getTransactionHolder()); } catch (Exception ex) { if (tx != null) tx.close(); throw new CannotCreateTransactionException("Could not create Ignite transaction", ex); } }
@Override public int getTimeout() { return this.targetDefinition.getTimeout(); }
@Override public int getTimeout() { return this.targetDefinition.getTimeout(); }
/** * Determine the actual timeout to use for the given definition. * Will fall back to this manager's default timeout if the * transaction definition doesn't specify a non-default value. * @param definition the transaction definition * @return the actual timeout to use * @see org.springframework.transaction.TransactionDefinition#getTimeout() * @see #setDefaultTimeout */ protected int determineTimeout(TransactionDefinition definition) { if (definition.getTimeout() != TransactionDefinition.TIMEOUT_DEFAULT) { return definition.getTimeout(); } return this.defaultTimeout; }
@Test //INT-2649 public void transactionalSubElement() throws Exception { Object endpoint = context.getBean("delayerWithTransactional"); DelayHandler delayHandler = TestUtils.getPropertyValue(endpoint, "handler", DelayHandler.class); List<?> adviceChain = TestUtils.getPropertyValue(delayHandler, "delayedAdviceChain", List.class); assertEquals(1, adviceChain.size()); Object advice = adviceChain.get(0); assertTrue(advice instanceof TransactionInterceptor); TransactionAttributeSource transactionAttributeSource = ((TransactionInterceptor) advice).getTransactionAttributeSource(); assertTrue(transactionAttributeSource instanceof MatchAlwaysTransactionAttributeSource); Method method = MessageHandler.class.getMethod("handleMessage", Message.class); TransactionDefinition definition = transactionAttributeSource.getTransactionAttribute(method, null); assertEquals(TransactionDefinition.PROPAGATION_REQUIRED, definition.getPropagationBehavior()); assertEquals(TransactionDefinition.ISOLATION_DEFAULT, definition.getIsolationLevel()); assertEquals(TransactionDefinition.TIMEOUT_DEFAULT, definition.getTimeout()); assertFalse(definition.isReadOnly()); }
/** * Copy constructor. Definition can be modified through bean property setters. * @see #setPropagationBehavior * @see #setIsolationLevel * @see #setTimeout * @see #setReadOnly * @see #setName */ public DefaultTransactionDefinition(TransactionDefinition other) { this.propagationBehavior = other.getPropagationBehavior(); this.isolationLevel = other.getIsolationLevel(); this.timeout = other.getTimeout(); this.readOnly = other.isReadOnly(); this.name = other.getName(); }
/** * Copy constructor. Definition can be modified through bean property setters. * @see #setPropagationBehavior * @see #setIsolationLevel * @see #setTimeout * @see #setReadOnly * @see #setName */ public DefaultTransactionDefinition(TransactionDefinition other) { this.propagationBehavior = other.getPropagationBehavior(); this.isolationLevel = other.getIsolationLevel(); this.timeout = other.getTimeout(); this.readOnly = other.isReadOnly(); this.name = other.getName(); }
public CustomizableRollbackTransactionAttribute(TransactionDefinition other) { super(); setPropagationBehavior(other.getPropagationBehavior()); setIsolationLevel(other.getIsolationLevel()); setTimeout(other.getTimeout()); setReadOnly(other.isReadOnly()); setName(other.getName()); }