Skip to content

Commit e7e55f2

Browse files
committed
Throw SHUTDOWN error received from Redis (#2613)
1 parent b4c1848 commit e7e55f2

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

src/main/java/redis/clients/jedis/BinaryJedis.java

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3442,16 +3442,19 @@ public Long lastsave() {
34423442
* is switched off without the lost of any data. This is not guaranteed if the client uses simply
34433443
* {@link #save() SAVE} and then {@link #quit() QUIT} because other clients may alter the DB data
34443444
* between the two commands.
3445-
* @return Status code reply on error. On success nothing is returned since the server quits and
3446-
* the connection is closed.
3445+
* @return {@code null}
3446+
* @throws JedisException with the status code reply on error. On success nothing is thrown since
3447+
* the server quits and the connection is closed.
34473448
*/
34483449
@Override
3449-
public String shutdown() {
3450+
public String shutdown() throws JedisException {
34503451
client.shutdown();
34513452
String status;
34523453
try {
34533454
status = client.getStatusCodeReply();
3454-
} catch (JedisException ex) {
3455+
throw new JedisException(status);
3456+
} catch (JedisConnectionException jce) {
3457+
// expected
34553458
status = null;
34563459
}
34573460
return status;
@@ -3461,8 +3464,8 @@ public String shutdown() {
34613464
public void shutdown(final SaveMode saveMode) throws JedisException {
34623465
client.shutdown(saveMode);
34633466
try {
3464-
throw new JedisDataException(client.getStatusCodeReply());
3465-
} catch (JedisConnectionException ex) {
3467+
throw new JedisException(client.getStatusCodeReply());
3468+
} catch (JedisConnectionException jce) {
34663469
// expected
34673470
}
34683471
}

src/main/java/redis/clients/jedis/commands/BasicCommands.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,10 @@ public interface BasicCommands {
134134
/**
135135
* Stop all the client. Perform a SAVE (if one save point is configured). Flush the append only
136136
* file if AOF is enabled quit the server
137-
* @return only in case of error.
137+
* @return {@code null}
138+
* @throws JedisException only in case of error.
138139
*/
139-
String shutdown();
140+
String shutdown() throws JedisException;
140141

141142
/**
142143
* @see SaveMode

0 commit comments

Comments
 (0)