1

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>
 */
Robert
  • 7,394
  • 40
  • 45
  • 64
Marius
  • 11
  • 2
  • What are you trying to do? This sounds like a [xy problem](https://xyproblem.info/). Why do you need to know how often it's called and why do you want to configure anything here? – Robert Aug 03 '23 at 19:06
  • 1
    Our DB is getting flooded by this query: select processins0_.InstanceId as col_0_0_ from ProcessInstanceInfo processins0_ where (:1 in(select eventtypes1_.element from EventTypes eventtypes1_ where processins0_.InstanceId=eventtypes1_.InstanceId)) We are trying to understand what events fire the execution of the aforementioned query. – Marius Aug 04 '23 at 09:35

0 Answers0