Skip to content

Commit

Permalink
Throw SHUTDOWN error received from Redis (#2613)
Browse files Browse the repository at this point in the history
  • Loading branch information
sazzad16 committed Aug 7, 2021
1 parent b4c1848 commit e7e55f2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
15 changes: 9 additions & 6 deletions src/main/java/redis/clients/jedis/BinaryJedis.java
Original file line number Diff line number Diff line change
Expand Up @@ -3442,16 +3442,19 @@ public Long lastsave() {
* is switched off without the lost of any data. This is not guaranteed if the client uses simply
* {@link #save() SAVE} and then {@link #quit() QUIT} because other clients may alter the DB data
* between the two commands.
* @return Status code reply on error. On success nothing is returned since the server quits and
* the connection is closed.
* @return {@code null}
* @throws JedisException with the status code reply on error. On success nothing is thrown since
* the server quits and the connection is closed.
*/
@Override
public String shutdown() {
public String shutdown() throws JedisException {
client.shutdown();
String status;
try {
status = client.getStatusCodeReply();
} catch (JedisException ex) {
throw new JedisException(status);
} catch (JedisConnectionException jce) {
// expected
status = null;
}
return status;
Expand All @@ -3461,8 +3464,8 @@ public String shutdown() {
public void shutdown(final SaveMode saveMode) throws JedisException {
client.shutdown(saveMode);
try {
throw new JedisDataException(client.getStatusCodeReply());
} catch (JedisConnectionException ex) {
throw new JedisException(client.getStatusCodeReply());
} catch (JedisConnectionException jce) {
// expected
}
}
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/redis/clients/jedis/commands/BasicCommands.java
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,10 @@ public interface BasicCommands {
/**
* Stop all the client. Perform a SAVE (if one save point is configured). Flush the append only
* file if AOF is enabled quit the server
* @return only in case of error.
* @return {@code null}
* @throws JedisException only in case of error.
*/
String shutdown();
String shutdown() throws JedisException;

/**
* @see SaveMode
Expand Down

0 comments on commit e7e55f2

Please sign in to comment.