JpaProcessPersistenceContext.findProcessInstanceInfo() uses LockModeType.PESSIMISTIC_FORCE_INCREMENT
LockModeType.PESSIMISTIC_FORCE_INCREMENT always issues "select for update" with "nowait".
The request is to be able to:
- Use "select for update" without "nowait"
- Use "javax.persistence.lock.timeout" as a hint of pessimistic lock timeout. (Only feasible to some databases. https://docs.oracle.com/javaee/7/tutorial/persistence-locking002.htm#GKJIU)
It would be likely to change from LockModeType.PESSIMISTIC_FORCE_INCREMENT to LockModeType.PESSIMISTIC_WRITE.
This change would break backward compatibility so please introduce this feature with a environment entry switch e.g. "org.kie.api.persistence.pessimistic.wait" (= if you don't give the entry, the default behaviour would be the same ... "select for update nowait").
Additional note: PostgreSQLDialect (even PostgreSQL itself) doesn't support time based wait so the timeout value is meaningless.
However, this enhancement is still useful because users can choose "select for update" without "nowait".