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

joerghoh pushed a commit to branch master
in repository 
https://gitbox.apache.org/repos/asf/sling-org-apache-sling-distribution-journal.git


The following commit(s) were added to refs/heads/master by this push:
     new c3b817a  improved the message of the RuntimeException (#96)
c3b817a is described below

commit c3b817a24a35a2bac1aeea4154ae4ba12a25e1cb
Author: Jörg Hoh <[email protected]>
AuthorDate: Wed Jan 26 11:44:03 2022 +0100

    improved the message of the RuntimeException (#96)
    
    * 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..ad51c7f 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