/** * Release the savepoint that is held for the transaction. */ public void releaseHeldSavepoint() throws TransactionException { Object savepoint = getSavepoint(); if (savepoint == null) { throw new TransactionUsageException( "Cannot release savepoint - no savepoint associated with current transaction"); } getSavepointManager().releaseSavepoint(savepoint); setSavepoint(null); }
protected ConnectionHolder getConnectionHolderForSavepoint() throws TransactionException { if (!isSavepointAllowed()) { throw new NestedTransactionNotSupportedException( "Transaction manager does not allow nested transactions"); } if (!hasConnectionHolder()) { throw new TransactionUsageException( "Cannot create nested transaction when not exposing a JDBC transaction"); } return getConnectionHolder(); }
/** * Roll back to the savepoint that is held for the transaction * and release the savepoint right afterwards. */ public void rollbackToHeldSavepoint() throws TransactionException { Object savepoint = getSavepoint(); if (savepoint == null) { throw new TransactionUsageException( "Cannot roll back to savepoint - no savepoint associated with current transaction"); } getSavepointManager().rollbackToSavepoint(savepoint); getSavepointManager().releaseSavepoint(savepoint); setSavepoint(null); }
/** * Release the savepoint that is held for the transaction. */ public void releaseHeldSavepoint() throws TransactionException { Object savepoint = getSavepoint(); if (savepoint == null) { throw new TransactionUsageException( "Cannot release savepoint - no savepoint associated with current transaction"); } getSavepointManager().releaseSavepoint(savepoint); setSavepoint(null); }
/** * Roll back to the savepoint that is held for the transaction * and release the savepoint right afterwards. */ public void rollbackToHeldSavepoint() throws TransactionException { Object savepoint = getSavepoint(); if (savepoint == null) { throw new TransactionUsageException( "Cannot roll back to savepoint - no savepoint associated with current transaction"); } getSavepointManager().rollbackToSavepoint(savepoint); getSavepointManager().releaseSavepoint(savepoint); setSavepoint(null); }
/** * Add an attribute for a transactional method. * Method names can end or start with "*" for matching multiple methods. * @param name class and method name, separated by a dot * @param attr attribute associated with the method */ public void addTransactionalMethod(String name, TransactionAttribute attr) { int lastDotIndex = name.lastIndexOf("."); if (lastDotIndex == -1) { throw new TransactionUsageException("'" + name + "' is not a valid method name: format is FQN.methodName"); } String className = name.substring(0, lastDotIndex); String methodName = name.substring(lastDotIndex + 1); try { Class clazz = ClassUtils.forName(className); addTransactionalMethod(clazz, methodName, attr); } catch (ClassNotFoundException ex) { throw new TransactionUsageException("Class '" + className + "' not found"); } }
/** * Resume a previously suspended transaction. */ @Override protected void doResume(Object txObj, Object suspendedResources) { // Sanity check if (this.getCurrent() != null) throw new TransactionUsageException("there is already a transaction associated with the current thread"); // Resume transaction final JTransaction jtx = (JTransaction)suspendedResources; if (this.logger.isTraceEnabled()) this.logger.trace("resuming JSimpleDB transaction " + jtx); JTransaction.setCurrent(jtx); }
/** * Resume a previously suspended transaction. */ @Override protected void doResume(Object txObj, Object suspendedResources) { // Sanity check if (this.getCurrent() != null) throw new TransactionUsageException("there is already a transaction associated with the current thread"); // Resume transaction final JTransaction jtx = (JTransaction)suspendedResources; if (this.logger.isTraceEnabled()) this.logger.trace("resuming Permazen transaction " + jtx); JTransaction.setCurrent(jtx); }
/** * Suspend the current transaction. */ @Override protected Object doSuspend(Object txObj) { // Sanity check final JTransaction jtx = ((TxWrapper)txObj).getJTransaction(); if (jtx == null) throw new TransactionUsageException("no JTransaction exists in the provided transaction object"); if (jtx != this.getCurrent()) throw new TransactionUsageException("the provided transaction object contains the wrong JTransaction"); // Suspend it if (this.logger.isTraceEnabled()) this.logger.trace("suspending current JSimpleDB transaction " + jtx); JTransaction.setCurrent(null); // Done return jtx; }
/** * Suspend the current transaction. */ @Override protected Object doSuspend(Object txObj) { // Sanity check final JTransaction jtx = ((TxWrapper)txObj).getJTransaction(); if (jtx == null) throw new TransactionUsageException("no JTransaction exists in the provided transaction object"); if (jtx != this.getCurrent()) throw new TransactionUsageException("the provided transaction object contains the wrong JTransaction"); // Suspend it if (this.logger.isTraceEnabled()) this.logger.trace("suspending current Permazen transaction " + jtx); JTransaction.setCurrent(null); // Done return jtx; }
protected ConnectionHolder getConnectionHolderForSavepoint() throws TransactionException { if (!isSavepointAllowed()) { throw new NestedTransactionNotSupportedException( "Transaction manager does not allow nested transactions"); } if (!hasConnectionHolder()) { throw new TransactionUsageException( "Cannot create nested transaction when not exposing a JDBC transaction"); } return getConnectionHolder(); }
/** * Release the savepoint that is held for the transaction. */ public void releaseHeldSavepoint() throws TransactionException { Object savepoint = getSavepoint(); if (savepoint == null) { throw new TransactionUsageException( "Cannot release savepoint - no savepoint associated with current transaction"); } getSavepointManager().releaseSavepoint(savepoint); setSavepoint(null); }
/** * Release the savepoint that is held for the transaction. */ public void releaseHeldSavepoint() throws TransactionException { Object savepoint = getSavepoint(); if (savepoint == null) { throw new TransactionUsageException( "Cannot release savepoint - no savepoint associated with current transaction"); } getSavepointManager().releaseSavepoint(savepoint); setSavepoint(null); }
protected ConnectionHolder getConnectionHolderForSavepoint() throws TransactionException { if (!isSavepointAllowed()) { throw new NestedTransactionNotSupportedException( "Transaction manager does not allow nested transactions"); } if (!hasConnectionHolder()) { throw new TransactionUsageException( "Cannot create nested transaction if not exposing a JDBC transaction"); } return getConnectionHolder(); }
/** * Release the savepoint that is held for the transaction. */ public void releaseHeldSavepoint() throws TransactionException { if (!hasSavepoint()) { throw new TransactionUsageException("No savepoint associated with current transaction"); } getSavepointManager().releaseSavepoint(getSavepoint()); setSavepoint(null); }
/** * Roll back to the savepoint that is held for the transaction. */ public void rollbackToHeldSavepoint() throws TransactionException { if (!hasSavepoint()) { throw new TransactionUsageException("No savepoint associated with current transaction"); } getSavepointManager().rollbackToSavepoint(getSavepoint()); setSavepoint(null); }
/** * Roll back to the savepoint that is held for the transaction * and release the savepoint right afterwards. */ public void rollbackToHeldSavepoint() throws TransactionException { Object savepoint = getSavepoint(); if (savepoint == null) { throw new TransactionUsageException( "Cannot roll back to savepoint - no savepoint associated with current transaction"); } getSavepointManager().rollbackToSavepoint(savepoint); getSavepointManager().releaseSavepoint(savepoint); setSavepoint(null); }
/** * Roll back to the savepoint that is held for the transaction * and release the savepoint right afterwards. */ public void rollbackToHeldSavepoint() throws TransactionException { Object savepoint = getSavepoint(); if (savepoint == null) { throw new TransactionUsageException( "Cannot roll back to savepoint - no savepoint associated with current transaction"); } getSavepointManager().rollbackToSavepoint(savepoint); getSavepointManager().releaseSavepoint(savepoint); setSavepoint(null); }
RDFBeanTransaction tx = txObj.getTransaction(); if (tx == null) { throw new TransactionUsageException("no transaction active");
RDFBeanTransaction tx = txObj.getTransaction(); if (tx == null) { throw new TransactionUsageException("no transaction active");