File tree 1 file changed +11
-3
lines changed
src/main/java/redis/clients/jedis
1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -190,13 +190,21 @@ public void connect() throws JedisConnectionException {
190
190
191
191
outputStream = new RedisOutputStream (socket .getOutputStream ());
192
192
inputStream = new RedisInputStream (socket .getInputStream ());
193
+
194
+ broken = false ; // unset broken status when connection is (re)initialized
195
+
193
196
} catch (JedisConnectionException jce ) {
194
- broken = true ;
197
+
198
+ setBroken ();
195
199
throw jce ;
200
+
196
201
} catch (IOException ioe ) {
197
- broken = true ;
202
+
203
+ setBroken ();
198
204
throw new JedisConnectionException ("Failed to create input/output stream" , ioe );
205
+
199
206
} finally {
207
+
200
208
if (broken ) {
201
209
IOUtils .closeQuietly (socket );
202
210
}
@@ -228,10 +236,10 @@ public void disconnect() {
228
236
outputStream .flush ();
229
237
socket .close ();
230
238
} catch (IOException ex ) {
231
- broken = true ;
232
239
throw new JedisConnectionException (ex );
233
240
} finally {
234
241
IOUtils .closeQuietly (socket );
242
+ setBroken ();
235
243
}
236
244
}
237
245
}
You can’t perform that action at this time.
0 commit comments