Uploaded image for project: 'Red Hat Process Automation Manager'
  1. Red Hat Process Automation Manager
  2. RHPAM-1573

Able to lock without "nowait" for jBPM pessimistic locking

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Done
    • Icon: Major Major
    • 7.2.0.GA
    • 7.0.2.GA
    • jBPM Core

      JpaProcessPersistenceContext.findProcessInstanceInfo() uses LockModeType.PESSIMISTIC_FORCE_INCREMENT

      https://github.com/kiegroup/jbpm/blob/7.7.0.Final/jbpm-persistence/jbpm-persistence-jpa/src/main/java/org/jbpm/persistence/JpaProcessPersistenceContext.java#L68

      LockModeType.PESSIMISTIC_FORCE_INCREMENT always issues "select for update" with "nowait".

      https://github.com/hibernate/hibernate-orm/blob/5.1.10/hibernate-core/src/main/java/org/hibernate/dialect/Dialect.java#L1195-L1196

      The request is to be able to:

      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.

      https://github.com/hibernate/hibernate-orm/blob/5.1.10/hibernate-core/src/main/java/org/hibernate/dialect/PostgreSQL81Dialect.java#L502-L509

      However, this enhancement is still useful because users can choose "select for update" without "nowait".

              swiderski.maciej Maciej Swiderski (Inactive)
              rhn-support-tkobayas Toshiya Kobayashi
              Marian Macik Marian Macik
              Marian Macik Marian Macik
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

                Created:
                Updated:
                Resolved: