Uploaded image for project: 'jBPM'
  1. jBPM
  2. JBPM-7822

Able to lock without "nowait" for jBPM pessimistic locking

XMLWordPrintable

    • 1
    • NEW
    • NEW
    • 2018 Week 39-41

      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
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: