Package org.drools.persistence.jpa
Class JpaPersistenceContextManager
java.lang.Object
org.drools.persistence.jpa.AbstractPersistenceContextManager
org.drools.persistence.jpa.JpaPersistenceContextManager
- All Implemented Interfaces:
PersistenceContextManager
public class JpaPersistenceContextManager
extends AbstractPersistenceContextManager
implements PersistenceContextManager
This class manages
JpaPersistenceContext objects, and the underlying persistence context (EntityManager)
instances for a persistent KieSession and other infrastructure classes that use persistence in KIE projects.
(For reference in the following documentation: the EntityManager is the class used to represent a persistence context)
There are 2 issues to take into account when looking at or modifying the code here: - One of the features made available here is the ability for the user to supply their own (Command Scoped) persistence
context for use by the
KieSession - However, significant race-conditions arise when a Command Scoped persistence context is used in one persistent
KieSessionby multiple threads. In other words, when multiple threads call operations on a Singleton persistentKieSession.
ThreadLocal instances for two things:- The internal Command Scoped
EntityManagerinstance.
-
Field Summary
Fields inherited from class org.drools.persistence.jpa.AbstractPersistenceContextManager
appScopedEntityManager, cmdScopedEntityManager, emf, env, internalAppScopedEntityManagerFlag, internalCmdScopedEntityManagerFlag, txm -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidMethods inherited from class org.drools.persistence.jpa.AbstractPersistenceContextManager
dispose, endCommandScopedEntityManager, getApplicationScopedEntityManager, getCommandScopedEntityManager, getInternalCommandScopedEntityManager, resetApplicationScopedPersistenceContextMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.drools.persistence.api.PersistenceContextManager
dispose, endCommandScopedEntityManager, resetApplicationScopedPersistenceContext
-
Constructor Details
-
JpaPersistenceContextManager
-
-
Method Details
-
getApplicationScopedPersistenceContext
- Specified by:
getApplicationScopedPersistenceContextin interfacePersistenceContextManager
-
getCommandScopedPersistenceContext
- Specified by:
getCommandScopedPersistenceContextin interfacePersistenceContextManager
-
beginCommandScopedEntityManager
public void beginCommandScopedEntityManager()- Specified by:
beginCommandScopedEntityManagerin interfacePersistenceContextManager
-