org.modeshape.jcr.txn

## Class SynchronizedTransactions

- java.lang.Object
- - org.modeshape.jcr.txn.Transactions
  - - org.modeshape.jcr.txn.SynchronizedTransactions

-     public final class SynchronizedTransactions
      extends Transactions

  An implementation of `Transactions` that will attempt to register a `Synchronization` with the current transaction.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `protected class` | `SynchronizedTransactions.RollbackOnlyTransaction`
    `protected class` | `SynchronizedTransactions.SynchronizedTransaction`
    `protected class` | `SynchronizedTransactions.TransactionTracer`
    `protected static class` | `SynchronizedTransactions.WorkspaceUpdates`

    - ### Nested classes/interfaces inherited from class org.modeshape.jcr.txn.Transactions

      `Transactions.BaseTransaction, Transactions.SimpleTransaction, Transactions.TraceableSimpleTransaction, Transactions.Transaction, Transactions.TransactionFunction`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected static Set<String>` | `ACTIVE_TRACE_SYNCHRONIZATIONS`

    - ### Fields inherited from class org.modeshape.jcr.txn.Transactions

      `logger, txnMgr`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SynchronizedTransactions(TransactionManager txnMgr)` Creates a new instance which wrapps a transaction manager and monitor factory

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Transactions.Transaction` | `begin()` Starts a new transaction if one does not already exist, and associate it with the calling thread.
    `void` | `updateCache(WorkspaceCache workspace, ChangeSet changes, Transactions.Transaction transaction)` Notify the workspace of the supplied changes, if and when the current transaction is completed.

    - ### Methods inherited from class org.modeshape.jcr.txn.Transactions

      `currentTransactionId, getTransactionManager, isCurrentlyInTransaction, resume, suspend`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### ACTIVE_TRACE_SYNCHRONIZATIONS

          protected static final Set<String> ACTIVE_TRACE_SYNCHRONIZATIONS

  - ### Constructor Detail

    - #### SynchronizedTransactions

          public SynchronizedTransactions(TransactionManager txnMgr)

      Creates a new instance which wrapps a transaction manager and monitor factory
      Parameters:
        `txnMgr` - a `TransactionManager` instance; never null

  - ### Method Detail

    - #### begin

          public Transactions.Transaction begin()
                                         throws NotSupportedException,
                                                SystemException

      Description copied from class: `Transactions`
      Starts a new transaction if one does not already exist, and associate it with the calling thread.
      Specified by:
        `begin` in class `Transactions`
      Returns:
        the ModeShape transaction
      Throws:
        `NotSupportedException` - If the calling thread is already associated with a transaction, and nested transactions are not supported.
        `SystemException` - If the transaction service fails in an unexpected way.

    - #### updateCache

          public void updateCache(WorkspaceCache workspace,
                         ChangeSet changes,
                         Transactions.Transaction transaction)

      Description copied from class: `Transactions`
      Notify the workspace of the supplied changes, if and when the current transaction is completed. If the current thread is not associated with a transaction when this method is called (e.g., the transaction was started, changes were made, the transaction was committed, and then this method was called), then the workspace is notified immediately. Otherwise, the notifications will be accumulated until the current transaction is committed.
      Overrides:
        `updateCache` in class `Transactions`
      Parameters:
        `workspace` - the workspace to which the changes were made; may not be null
        `changes` - the changes; may be null if there are no changes
        `transaction` - the transaction with which the changes were made; may not be null

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