com.hammurapi.common.concurrent.transactions

## Class AbstractTransactionalProcessor<KP>

- java.lang.Object
- - com.hammurapi.common.concurrent.transactions.AbstractTransactionalProcessor<KP>

- Type Parameters:
    `KP` -
  Direct Known Subclasses:
    StandaloneTransactionalProcessor

      public abstract class AbstractTransactionalProcessor<KP>
      extends Object

  This class performs concurrent transactional computations.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `protected class` | `AbstractTransactionalProcessor.SimpleTransactionPropagation` Propagates transaction object AS-IS
    `protected static interface` | `AbstractTransactionalProcessor.TransactionPropagation` Interface to propagate transactions between threads.

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected ThreadLocal<Transaction>` | `threadTransaction`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `AbstractTransactionalProcessor(ExecutorService executorService)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected abstract Transaction` | `beginTransaction()` Concrete implementations begin transaction and return transaction instance.
    `protected MutableContext` | `createContext(ExecutionContext<KP> owner, Context... chain)` Creates mutable context for execution context.
    `protected ProgressMonitor` | `createProgressMonitor(String name)`
    `PropertySet<KP>` | `createPropertySet(Context context, PropertySet<KP>... chain)`
    `protected abstract PropertySet<KP>` | `createPropertySet(ExecutorService executorService, Context context, PropertySet<KP>... chain)`
    `protected AbstractTransactionalProcessor.TransactionPropagation` | `createTransactionPropagation(Transaction transaction)` Creates transaction propagation.
    `Transaction` | `getCurrentTransaction()`
    `<V> V` | `process(Command<KP,V> command, Context context, PropertySet<KP> propertySet, Object... args)` Transactionally processes the command.
    `protected void` | `registerXAResource(String uniqueId, XAResource xaResource)`
    `void` | `setProgressMonitorFactory(ProgressMonitorFactory progressMonitorFactory)`
    `protected void` | `unregisterXAResource(String uniqueId, XAResource xaResource)`

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

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

- - ### Field Detail

    - #### threadTransaction

          protected ThreadLocal<Transaction> threadTransaction

  - ### Constructor Detail

    - #### AbstractTransactionalProcessor

          protected AbstractTransactionalProcessor(ExecutorService executorService)

  - ### Method Detail

    - #### createTransactionPropagation

          protected AbstractTransactionalProcessor.TransactionPropagation createTransactionPropagation(Transaction transaction)

      Creates transaction propagation. This implementation creates SimpleTransactionPropagation
      Parameters:
        `transaction` -
      Returns:

    - #### getCurrentTransaction

          public Transaction getCurrentTransaction()

      Returns:
        Thread's context transaction.

    - #### createPropertySet

          protected abstract PropertySet<KP> createPropertySet(ExecutorService executorService,
                                          Context context,
                                          PropertySet<KP>... chain)

    - #### createPropertySet

          public PropertySet<KP> createPropertySet(Context context,
                                          PropertySet<KP>... chain)

    - #### setProgressMonitorFactory

          public void setProgressMonitorFactory(ProgressMonitorFactory progressMonitorFactory)

    - #### createProgressMonitor

          protected ProgressMonitor createProgressMonitor(String name)

    - #### beginTransaction

          protected abstract Transaction beginTransaction()
                                                   throws NotSupportedException,
                                                          SystemException

      Concrete implementations begin transaction and return transaction instance.
      Returns:
      Throws:
        `NotSupportedException`
        `SystemException`

    - #### registerXAResource

          protected void registerXAResource(String uniqueId,
                                XAResource xaResource)

    - #### unregisterXAResource

          protected void unregisterXAResource(String uniqueId,
                                  XAResource xaResource)

    - #### process

          public <V> V process(Command<KP,V> command,
                      Context context,
                      PropertySet<KP> propertySet,
                      Object... args)
                    throws Exception

      Transactionally processes the command.
      Parameters:
        `command` -
      Returns:
      Throws:
        `Exception`

    - #### createContext

          protected MutableContext createContext(ExecutionContext<KP> owner,
                                     Context... chain)

      Creates mutable context for execution context. Subclasses can override this method to inject specific values into the context, e.g. hierarchical logger.
      Parameters:
        `owner` -
        `chain` -
      Returns: