Class 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.
    • 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