Handle disconnect at doStop
This commit is contained in:
parent
5a4b3cb38a
commit
f1c53077a4
@ -68,6 +68,7 @@ public class RedisLookupDataAdapter extends LookupDataAdapter {
|
||||
private final Config config;
|
||||
private final RedisClient client;
|
||||
private RedisCommands<String, String> commands;
|
||||
private StatefulRedisConnection<String, String> connection;
|
||||
private final Timer redisGetRequestTimer;
|
||||
private final Meter redisGetRequestErrors;
|
||||
private final Timer redisSetRequestTimer;
|
||||
@ -102,14 +103,15 @@ public class RedisLookupDataAdapter extends LookupDataAdapter {
|
||||
// Add code to initialise Redis connection
|
||||
@Override
|
||||
protected void doStart() throws Exception {
|
||||
StatefulRedisConnection<String, String> connection = this.client.connect();
|
||||
connection = this.client.connect();
|
||||
this.commands = connection.sync();
|
||||
}
|
||||
|
||||
// Add code to close Redis connection
|
||||
@Override
|
||||
protected void doStop() throws Exception {
|
||||
|
||||
connection.close();
|
||||
client.close();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user