Changes to org.jgroups.blocks.atomic.SyncCounter to throw checked Exceptions

14 views
Skip to first unread message

mzaza (mipsc)

unread,
Apr 24, 2025, 6:40:27 AMApr 24
to jgroups-dev
Hi all,

Blocking SyncCounter methods (get(), set() etc.) internally call the asynchronous counterparts while blocking with CompletableFutures.join() which swallows all checked exceptions into a RuntimeException, causing reliability issues when the operation can temporarily not be completed because of a transient failure.

Since those methods are defined in org.jgroups.blocks.atomic.SyncCounter, which doesn't declare any checked exceptions on the signatures, the implementations cannot do that neither.

A potential fix would be to change the definitions in SyncCounter to throw exceptions and have the implementations use CompletableFuture.get() allowing the caller to handle any exceptions properly.

Before going further, I'd like to ask:

Is anyone relying on the current SyncCounter signatures such that this change would cause compatibility issues or break existing usage?

Appreciate the feedback, if no one sees a problem with that, I'd be happy to forward with a PR with the proposed changes.

Further details and context in this github issue in the jgroups-raft repo

Best,
mipsc

mzaza (mipsc)

unread,
Apr 26, 2025, 1:24:51 AMApr 26
to jgroups-dev
Reply all
Reply to author
Forward
0 new messages