Skip to content

Commit

Permalink
Meaningful variable name for JedisBroadcastException
Browse files Browse the repository at this point in the history
  • Loading branch information
sazzad16 committed Aug 30, 2023
1 parent 7af02d5 commit 929d92d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* Note: This exception extends {@link JedisDataException} just so existing applications catching
* JedisDataException do not get broken.
*/
// TODO: extends JedisException
public class JedisBroadcastException extends JedisDataException {

private static final String BROADCAST_ERROR_MESSAGE = "A failure occurred while broadcasting the command.";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ public final <T> T broadcastCommand(CommandObject<T> commandObject) {

boolean isErrored = false;
T reply = null;
JedisBroadcastException holder = new JedisBroadcastException();
JedisBroadcastException bcastError = new JedisBroadcastException();
for (Map.Entry<String, ConnectionPool> entry : connectionMap.entrySet()) {
HostAndPort node = HostAndPort.from(entry.getKey());
ConnectionPool pool = entry.getValue();
try (Connection connection = pool.getResource()) {
try {
T aReply = execute(connection, commandObject);
holder.addReply(node, aReply);
bcastError.addReply(node, aReply);
if (isErrored) { // already errored
} else if (reply == null) {
reply = aReply; // ok
Expand All @@ -61,12 +61,12 @@ public final <T> T broadcastCommand(CommandObject<T> commandObject) {
reply = null;
}
} catch (JedisDataException anError) {
holder.addError(node, anError);
bcastError.addError(node, anError);
}
}
}
if (isErrored) {
throw holder;
throw bcastError;
}
return reply;
}
Expand Down

0 comments on commit 929d92d

Please sign in to comment.