Uploaded image for project: 'JBoss Transaction Manager'
  1. JBoss Transaction Manager
  2. JBTM-3989

LRA coordinator can't handle parallel participant enlistments

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Done
    • Icon: Major Major
    • Narayana-LRA-1.0.1.Final
    • None
    • LRA
    • None

      The LRA coordinator contains the following code to enlist participants:

      io.narayana.lra.coordinator.domain.model.LongRunningAction.enlistParticipant(URI, String, String, long, String, String)
      
      public LRAParticipantRecord enlistParticipant(URI coordinatorUrl, String participantUrl, String recoveryUrlBase, long timeLimit, String compensatorData, String version)
                  throws UnsupportedEncodingException {
              ReentrantLock lock = tryLockTransaction();
              if (lock == null) {
                  String reason = LRALogger.i18nLogger.warn_enlistment();
                  LRALogger.logger.warn(reason);
                  throw new ServiceUnavailableException(reason);
              }
      

      This calls tryLockTransaction which eventually calls

      io.narayana.lra.coordinator.domain.service.LRAService.tryLockTransaction(URI)
      
      public synchronized ReentrantLock tryLockTransaction(URI lraId) {
              ReentrantLock lock = locks.computeIfAbsent(lraId, k -> new ReentrantLock());
      
              return lock.tryLock() ? lock : null;
      }
      

      Here the lock is tried, and if not obtained immediately fails, and then immediately fails the entire request.

      This seems a bit too much. I would expect at least a small timeout here, and even better if that timeout could be configured.

              Unassigned Unassigned
              arjan.tijms@gmail.com Arjan Tijms (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: