org.jbpm.persistence.jta

## Class ContainerManagedTransactionManager

- java.lang.Object
- - org.jbpm.persistence.jta.ContainerManagedTransactionManager

- All Implemented Interfaces:
    org.drools.persistence.api.TransactionManager

      public class ContainerManagedTransactionManager
      extends Object
      implements org.drools.persistence.api.TransactionManager

  Dedicated implementation of `TransactionManager` that should be used when:
  - jBPM engine is embedded in Container Managed Transaction (CMT) environment like EJB container
  - container that does not allow accessing UserTransaction (when running in CMT mode) - e.g. WebSphere Appliation Server
  Instance of this transaction manager must be set on Environment together with Persistence context manager instance to take effect. `Environment env = EnvironmentFactory.newEnvironment(); env.set(EnvironmentName.ENTITY_MANAGER_FACTORY, emf); env.set(EnvironmentName.TRANSACTION_MANAGER, new ContainerManagedTransactionManager()); env.set(EnvironmentName.PERSISTENCE_CONTEXT_MANAGER, new JpaProcessPersistenceContextManager(env)); env.set(EnvironmentName.TASK_PERSISTENCE_CONTEXT_MANAGER, new JPATaskPersistenceContextManager(env));` Since it dedicated to be run in CMT begine/commit/rollback are no-op methods.
  Status of the transaction is always Active.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected TransactionSynchronizationRegistry` | `txSyncRegistry`

    - ### Fields inherited from interface org.drools.persistence.api.TransactionManager

      `STATUS_ACTIVE, STATUS_COMMITTED, STATUS_NO_TRANSACTION, STATUS_ROLLEDBACK, STATUS_UNKNOWN`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ContainerManagedTransactionManager()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `begin()`
    `void` | `commit(boolean arg0)`
    `protected Object` | `findTransactionSynchronizationRegistry()`
    `Object` | `getResource(Object key)`
    `int` | `getStatus()`
    `void` | `putResource(Object key, Object resource)`
    `void` | `registerTransactionSynchronization(org.drools.persistence.api.TransactionSynchronization arg0)`
    `void` | `rollback(boolean arg0)`

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

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

- - ### Field Detail

    - #### txSyncRegistry

          protected TransactionSynchronizationRegistry txSyncRegistry

  - ### Constructor Detail

    - #### ContainerManagedTransactionManager

          public ContainerManagedTransactionManager()

  - ### Method Detail

    - #### begin

          public boolean begin()

      Specified by:
        `begin` in interface `org.drools.persistence.api.TransactionManager`

    - #### commit

          public void commit(boolean arg0)

      Specified by:
        `commit` in interface `org.drools.persistence.api.TransactionManager`

    - #### getStatus

          public int getStatus()

      Specified by:
        `getStatus` in interface `org.drools.persistence.api.TransactionManager`

    - #### registerTransactionSynchronization

          public void registerTransactionSynchronization(org.drools.persistence.api.TransactionSynchronization arg0)

      Specified by:
        `registerTransactionSynchronization` in interface `org.drools.persistence.api.TransactionManager`

    - #### rollback

          public void rollback(boolean arg0)

      Specified by:
        `rollback` in interface `org.drools.persistence.api.TransactionManager`

    - #### findTransactionSynchronizationRegistry

          protected Object findTransactionSynchronizationRegistry()

    - #### putResource

          public void putResource(Object key,
                                  Object resource)

      Specified by:
        `putResource` in interface `org.drools.persistence.api.TransactionManager`

    - #### getResource

          public Object getResource(Object key)

      Specified by:
        `getResource` in interface `org.drools.persistence.api.TransactionManager`

Copyright © 2001–2021 JBoss by Red Hat. All rights reserved.