This is an automated email from the ASF dual-hosted git repository.

joerghoh pushed a commit to branch improvement/SLING-11084-improve-exception
in repository 
https://gitbox.apache.org/repos/asf/sling-org-apache-sling-distribution-journal.git

commit 021f83777f65e049fa83bd736c00bcf1853dc38c
Author: Joerg Hoh <[email protected]>
AuthorDate: Mon Jan 24 15:18:12 2022 +0100

    improved the message of the RuntimeException
---
 .../apache/sling/distribution/journal/queue/impl/PubQueueCache.java | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git 
a/src/main/java/org/apache/sling/distribution/journal/queue/impl/PubQueueCache.java
 
b/src/main/java/org/apache/sling/distribution/journal/queue/impl/PubQueueCache.java
index bdb6e94..236118f 100644
--- 
a/src/main/java/org/apache/sling/distribution/journal/queue/impl/PubQueueCache.java
+++ 
b/src/main/java/org/apache/sling/distribution/journal/queue/impl/PubQueueCache.java
@@ -152,7 +152,11 @@ public class PubQueueCache {
             // run head pollers concurrently.
             boolean locked = headPollerLock.tryLock(MAX_FETCH_WAIT_MS, 
MILLISECONDS);
             if (! locked) {
-                throw new RuntimeException("Gave up fetching queue state");
+                String msg = String.format(
+                        "Gave up fetching the queue state after %d ms because 
another thread holds the lock "
+                                + "(requested offset = %d, cached min 
offset=%d",
+                        MAX_FETCH_WAIT_MS, requestedMinOffset, 
cachedMinOffset);
+                throw new RuntimeException(msg);
             }
             try {
 

Reply via email to