Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.slide.transaction
Class SlideTransactionManager

    java.lang.Object
      org.apache.slide.transaction.SlideTransactionManager

All Implemented Interfaces:
  javax.transaction.TransactionManager

public final class SlideTransactionManager
extends java.lang.Object
implements javax.transaction.TransactionManager

JTA Transaction manager implementation.

Implementation notes :

- Does not support nested transactions
- No security

Version:
  $Revision: 1.14 $

Field Summary
`static int` | `DEFAULT_TRANSACTION_TIMEOUT`
`protected static java.lang.String` | `LOG_CHANNEL`

Constructor Summary
`SlideTransactionManager()`

Method Summary
`void` | `begin()` Create a new transaction and associate it with the current thread.
`void` | `commit()` Complete the transaction associated with the current thread.
`Logger` | `getLogger()` Get the logger associated with the transaction manager.
`int` | `getStatus()` Obtain the status of the transaction associated with the current thread.
`javax.transaction.Transaction` | `getTransaction()` Get the transaction object that represents the transaction context of the calling thread.
`void` | `resume(javax.transaction.Transaction tobj)` Resume the transaction context association of the calling thread with the transaction represented by the supplied Transaction object.
`void` | `rollback()` Roll back the transaction associated with the current thread.
`void` | `setLogger(Logger logger)` Set the logger of the transaction manager.
`void` | `setRollbackOnly()` Modify the transaction associated with the current thread such that the only possible outcome of the transaction is to roll back the transaction.
`void` | `setTransactionTimeout(int seconds)` Modify the value of the timeout value that is associated with the transactions started by the current thread with the begin method.
`javax.transaction.Transaction` | `suspend()` Suspend the transaction currently associated with the calling thread and return a Transaction object that represents the transaction context being suspended.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### LOG_CHANNEL

    protected static final java.lang.String LOG_CHANNEL

### DEFAULT_TRANSACTION_TIMEOUT

    public static final int DEFAULT_TRANSACTION_TIMEOUT

See Also:
  Constant Field Values

Constructor Detail

### SlideTransactionManager

    public SlideTransactionManager()

Method Detail

### getLogger

    public Logger getLogger()

  Get the logger associated with the transaction manager.

### setLogger

    public void setLogger(Logger logger)

  Set the logger of the transaction manager.

### begin

    public void begin()
               throws javax.transaction.NotSupportedException,
                      javax.transaction.SystemException

  Create a new transaction and associate it with the current thread.

  Specified by:
    `begin` in interface `javax.transaction.TransactionManager`
  Throws:
    `javax.transaction.NotSupportedException` - Thrown if the thread is already associated with a transaction and the Transaction Manager implementation does not support nested transactions.
    `javax.transaction.SystemException` - Thrown if the transaction manager encounters an unexpected error condition.

### commit

    public void commit()
                throws javax.transaction.RollbackException,
                       javax.transaction.HeuristicMixedException,
                       javax.transaction.HeuristicRollbackException,
                       java.lang.SecurityException,
                       java.lang.IllegalStateException,
                       javax.transaction.SystemException

  Complete the transaction associated with the current thread. When this method completes, the thread becomes associated with no transaction. If the commit is terminated with an exception, the rollback should be called, to do a proper clean-up.

  Specified by:
    `commit` in interface `javax.transaction.TransactionManager`
  Throws:
    `javax.transaction.RollbackException` - Thrown to indicate that the transaction has been rolled back rather than committed.
    `javax.transaction.HeuristicMixedException` - Thrown to indicate that a heuristic decision was made and that some relevant updates have been committed while others have been rolled back.
    `javax.transaction.HeuristicRollbackException` - Thrown to indicate that a heuristic decision was made and that some relevant updates have been rolled back.
    `java.lang.SecurityException` - Thrown to indicate that the thread is not allowed to commit the transaction.
    `java.lang.IllegalStateException` - Thrown if the current thread is not associated with a transaction.
    `javax.transaction.SystemException` - Thrown if the transaction manager encounters an unexpected error condition.

### rollback

    public void rollback()
                  throws java.lang.SecurityException,
                         java.lang.IllegalStateException,
                         javax.transaction.SystemException

  Roll back the transaction associated with the current thread. When this method completes, the thread becomes associated with no transaction.

  Specified by:
    `rollback` in interface `javax.transaction.TransactionManager`
  Throws:
    `java.lang.SecurityException` - Thrown to indicate that the thread is not allowed to commit the transaction.
    `java.lang.IllegalStateException` - Thrown if the current thread is not associated with a transaction.
    `javax.transaction.SystemException` - Thrown if the transaction manager encounters an unexpected error condition.

### setRollbackOnly

    public void setRollbackOnly()
                         throws java.lang.IllegalStateException,
                                javax.transaction.SystemException

  Modify the transaction associated with the current thread such that the only possible outcome of the transaction is to roll back the transaction.

  Specified by:
    `setRollbackOnly` in interface `javax.transaction.TransactionManager`
  Throws:
    `java.lang.IllegalStateException` - Thrown if the current thread is not associated with a transaction.
    `javax.transaction.SystemException` - Thrown if the transaction manager encounters an unexpected error condition.

### getStatus

    public int getStatus()
                  throws javax.transaction.SystemException

  Obtain the status of the transaction associated with the current thread.

  Specified by:
    `getStatus` in interface `javax.transaction.TransactionManager`
  Returns:
    The transaction status. If no transaction is associated with the current thread, this method returns the Status.NoTransaction value.
  Throws:
    `javax.transaction.SystemException` - Thrown if the transaction manager encounters an unexpected error condition.

### getTransaction

    public javax.transaction.Transaction getTransaction()
                                                 throws javax.transaction.SystemException

  Get the transaction object that represents the transaction context of the calling thread.

  Specified by:
    `getTransaction` in interface `javax.transaction.TransactionManager`
  Returns:
    the Transaction object representing the transaction associated with the calling thread.
  Throws:
    `javax.transaction.SystemException` - Thrown if the transaction manager encounters an unexpected error condition.

### resume

    public void resume(javax.transaction.Transaction tobj)
                throws javax.transaction.InvalidTransactionException,
                       java.lang.IllegalStateException,
                       javax.transaction.SystemException

  Resume the transaction context association of the calling thread with the transaction represented by the supplied Transaction object. When this method returns, the calling thread is associated with the transaction context specified.

  Specified by:
    `resume` in interface `javax.transaction.TransactionManager`
  Parameters:
    `tobj` - The Transaction object that represents the transaction to be resumed.
  Throws:
    `javax.transaction.InvalidTransactionException` - Thrown if the parameter transaction object contains an invalid transaction.
    `java.lang.IllegalStateException` - Thrown if the thread is already associated with another transaction.
    `javax.transaction.SystemException` - Thrown if the transaction manager encounters an unexpected error condition.

### suspend

    public javax.transaction.Transaction suspend()
                                          throws javax.transaction.SystemException

  Suspend the transaction currently associated with the calling thread and return a Transaction object that represents the transaction context being suspended. If the calling thread is not associated with a transaction, the method returns a null object reference. When this method returns, the calling thread is associated with no transaction.

  Specified by:
    `suspend` in interface `javax.transaction.TransactionManager`
  Returns:
    Transaction object representing the suspended transaction.
  Throws:
    `javax.transaction.SystemException` - Thrown if the transaction manager encounters an unexpected error condition.

### setTransactionTimeout

    public void setTransactionTimeout(int seconds)
                               throws javax.transaction.SystemException

  Modify the value of the timeout value that is associated with the transactions started by the current thread with the begin method.

  If an application has not called this method, the transaction service uses some default value for the transaction timeout.

  Specified by:
    `setTransactionTimeout` in interface `javax.transaction.TransactionManager`
  Parameters:
    `seconds` - The value of the timeout in seconds. If the value is zero, the transaction service restores the default value.
  Throws:
    `javax.transaction.SystemException` - Thrown if the transaction manager encounters an unexpected error condition.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD