-
Enhancement
-
Resolution: Done
-
Major
-
None
-
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.