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

    Details

      Description

      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".

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              swiderski.maciej Maciej Swiderski
              Reporter:
              tkobayashi Toshiya Kobayashi
              Tester:
              Marian Macik Marian Macik
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: