Looking at the class JpaProcessPersistenceContext
I noticed this method getProcessInstancesWaitingForEvent
which uses this named query ProcessInstancesWaitingForEvent
. The aforementioned method should be used by the JPASignalManager
to cache the instances but I cannot understand how frequently it s called. Is there any configuration that can be done?
Tried to see if there is any documentation about this, all I could find was this comment in the class:
/**
* This method is used by the {@link JPASignalManager} in order to load {@link ProcessInstance} instances
* into the {@link ProcessInstanceManager} cache so that they can then be signalled.
* </p>
* 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.
* </p>
* Because the {@link org.drools.core.command.SingleSessionCommandService} design 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
* <a href="http://en.wikipedia.org/wiki/Isolation_%28database_systems%29#Phantom_reads">phantom read</a>
* race condition, that might be caused by a lack of pessimistic locking on this query, isn't possible.
* </p>
* 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.
* </p>
*/