Package org.jbpm.persistence
Class JpaProcessPersistenceContext
- java.lang.Object
-
- org.drools.persistence.jpa.JpaPersistenceContext
-
- org.jbpm.persistence.JpaProcessPersistenceContext
-
- All Implemented Interfaces:
org.drools.persistence.api.PersistenceContext,org.jbpm.persistence.api.ProcessPersistenceContext
public class JpaProcessPersistenceContext extends org.drools.persistence.jpa.JpaPersistenceContext implements org.jbpm.persistence.api.ProcessPersistenceContext
-
-
Constructor Summary
Constructors Constructor Description JpaProcessPersistenceContext(javax.persistence.EntityManager em, boolean useJTA, boolean locking, String lockingMode, org.drools.persistence.api.TransactionManager txm)JpaProcessPersistenceContext(javax.persistence.EntityManager em, org.drools.persistence.api.TransactionManager txm)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.jbpm.persistence.api.PersistentProcessInstancefindProcessInstanceInfo(Long processId)LonggetProcessInstanceByCorrelationKey(org.kie.internal.process.CorrelationKey correlationKey)With regards to locking, the method is not always called during a transaction, which means that including logic to lock the query will cause exceptions and is not feasible.List<Long>getProcessInstancesWaitingForEvent(String type)This method is used by theJPASignalManagerin order to loadProcessInstanceinstances into theProcessInstanceManagercache so that they can then be signalled.org.jbpm.persistence.api.PersistentCorrelationKeypersist(org.jbpm.persistence.api.PersistentCorrelationKey correlationKeyInfo)org.jbpm.persistence.api.PersistentProcessInstancepersist(org.jbpm.persistence.api.PersistentProcessInstance processInstanceInfo)voidremove(org.jbpm.persistence.api.PersistentProcessInstance processInstanceInfo)-
Methods inherited from class org.drools.persistence.jpa.JpaPersistenceContext
close, findSession, findWorkItem, getEntityManager, isOpen, joinTransaction, lock, lock, merge, persist, persist, remove, remove
-
-
-
-
Constructor Detail
-
JpaProcessPersistenceContext
public JpaProcessPersistenceContext(javax.persistence.EntityManager em, org.drools.persistence.api.TransactionManager txm)
-
JpaProcessPersistenceContext
public JpaProcessPersistenceContext(javax.persistence.EntityManager em, boolean useJTA, boolean locking, String lockingMode, org.drools.persistence.api.TransactionManager txm)
-
-
Method Detail
-
persist
public org.jbpm.persistence.api.PersistentProcessInstance persist(org.jbpm.persistence.api.PersistentProcessInstance processInstanceInfo)
- Specified by:
persistin interfaceorg.jbpm.persistence.api.ProcessPersistenceContext
-
findProcessInstanceInfo
public org.jbpm.persistence.api.PersistentProcessInstance findProcessInstanceInfo(Long processId)
- Specified by:
findProcessInstanceInfoin interfaceorg.jbpm.persistence.api.ProcessPersistenceContext
-
remove
public void remove(org.jbpm.persistence.api.PersistentProcessInstance processInstanceInfo)
- Specified by:
removein interfaceorg.jbpm.persistence.api.ProcessPersistenceContext
-
getProcessInstancesWaitingForEvent
public List<Long> getProcessInstancesWaitingForEvent(String type)
This method is used by theJPASignalManagerin order to loadProcessInstanceinstances into theProcessInstanceManagercache so that they can then be signalled. Unfortunately, with regards to locking, the method is not always called during a transaction, which means that including logic to lock the query will cause exceptions and is not feasible. Because theSingleSessionCommandServicedesign is based around a synchronized execute(...) method, it's not possible for one thread to create a process instance while another thread simultaneously tries to signal it. That means that a phantom read race condition, that might be caused by a lack of pessimistic locking on this query, isn't possible. Of course, if you're using multiple ksessions to simultaneoulsy interact with the same process instance, all bets are off. This however is true for almost everything involving process instances, so that it's not worth discussing.- Specified by:
getProcessInstancesWaitingForEventin interfaceorg.jbpm.persistence.api.ProcessPersistenceContext
-
persist
public org.jbpm.persistence.api.PersistentCorrelationKey persist(org.jbpm.persistence.api.PersistentCorrelationKey correlationKeyInfo)
- Specified by:
persistin interfaceorg.jbpm.persistence.api.ProcessPersistenceContext
-
getProcessInstanceByCorrelationKey
public Long getProcessInstanceByCorrelationKey(org.kie.internal.process.CorrelationKey correlationKey)
With regards to locking, the method is not always called during a transaction, which means that including logic to lock the query will cause exceptions and is not feasible. However, this is not an issue: see thegetProcessInstancesWaitingForEvent(String)documentation for more information. The same logic applies to this method.- Specified by:
getProcessInstanceByCorrelationKeyin interfaceorg.jbpm.persistence.api.ProcessPersistenceContext
-
-