Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| ModeShape Distribution 3.0.0.Alpha5
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.modeshape.jcr.txn
Interface Transactions.Transaction

All Superinterfaces:
  SessionEnvironment.MonitorFactory

All Known Implementing Classes:
  SynchronizedTransactions.RollbackOnlyTransaction, SynchronizedTransactions.SynchronizedTransaction, Transactions.BaseTransaction, Transactions.SimpleTransaction

Enclosing class:
  Transactions

    public static interface Transactions.Transaction

extends SessionEnvironment.MonitorFactory

The representation of a ModeShape fine-grained transaction for use when saving the changes made to a Session. Note that this transaction may wrap a newly-created transaction for the current thread, or it may wrap an existing and on-going transaction for the current thread. In either case, the caller still `commits` or `rollsback` the transaction as normal when it's work is done.

Method Summary
`void` | `commit()` Commit the transaction currently associated with the calling thread.
`SessionEnvironment.Monitor` | `createMonitor()` Get a monitor that should be used to capture what has changed during this transaction.
`void` | `rollback()` Rolls back the transaction currently associated with the calling thread.
`void` | `uponCompletion(Transactions.TransactionFunction function)` Register a function that will be called when the current transaction completes, or immediately if there is not currently an active transaction.

Method Detail

### createMonitor

    SessionEnvironment.Monitor createMonitor()

  Get a monitor that should be used to capture what has changed during this transaction.

  Specified by:
    `createMonitor` in interface `SessionEnvironment.MonitorFactory`
  Returns:
    the monitor, or null if there is no monitoring

### uponCompletion

    void uponCompletion(Transactions.TransactionFunction function)

  Register a function that will be called when the current transaction completes, or immediately if there is not currently an active transaction.

  Parameters:
    `function` - the completion function

### commit

    void commit()
                throws RollbackException,
                       HeuristicMixedException,
                       HeuristicRollbackException,
                       SecurityException,
                       IllegalStateException,
                       SystemException

  Commit the transaction currently associated with the calling thread.

  Throws:
    `RollbackException` - If the transaction was marked for rollback only, the transaction is rolled back and this exception is thrown.
    `IllegalStateException` - If the calling thread is not associated with a transaction.
    `SystemException` - If the transaction service fails in an unexpected way.
    `HeuristicMixedException` - If a heuristic decision was made and some some parts of the transaction have been committed while other parts have been rolled back.
    `HeuristicRollbackException` - If a heuristic decision to roll back the transaction was made.
    `SecurityException` - If the caller is not allowed to commit this transaction.

### rollback

    void rollback()
                  throws IllegalStateException,
                         SecurityException,
                         SystemException

  Rolls back the transaction currently associated with the calling thread.

  Throws:
    `IllegalStateException` - If the transaction is in a state where it cannot be rolled back. This could be because the calling thread is not associated with a transaction, or because it is in the `prepared state`.
    `SecurityException` - If the caller is not allowed to roll back this transaction.
    `SystemException` - If the transaction service fails in an unexpected way.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| ModeShape Distribution 3.0.0.Alpha5
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2008-2012 JBoss, a division of Red Hat. All Rights Reserved.