close mongoManager and redisManager connections on proxy shutdown
parent
ebcd6d1a58
commit
9a2f0ab15c
|
@ -85,6 +85,11 @@ public class ProxySystem extends Plugin {
|
||||||
this.kraSocketClient.getSocketClient().getConnection().close();
|
this.kraSocketClient.getSocketClient().getConnection().close();
|
||||||
this.kraSocketClient.getSocketClient().getConnection().closeConnection(1, "");
|
this.kraSocketClient.getSocketClient().getConnection().closeConnection(1, "");
|
||||||
|
|
||||||
|
this.mongoManager.getMongoClient().close();
|
||||||
|
|
||||||
|
this.redisManager.getConnection().close();
|
||||||
|
this.redisManager.getClient().shutdown();
|
||||||
|
|
||||||
instance = null;
|
instance = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@ package net.krakatoa.proxy.redis;
|
||||||
|
|
||||||
import io.lettuce.core.RedisClient;
|
import io.lettuce.core.RedisClient;
|
||||||
import io.lettuce.core.api.StatefulRedisConnection;
|
import io.lettuce.core.api.StatefulRedisConnection;
|
||||||
|
import io.lettuce.core.api.reactive.RedisKeyReactiveCommands;
|
||||||
import io.lettuce.core.api.sync.RedisStringCommands;
|
import io.lettuce.core.api.sync.RedisStringCommands;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
@ -13,12 +14,15 @@ public class RedisManager {
|
||||||
private RedisClient client;
|
private RedisClient client;
|
||||||
private StatefulRedisConnection<String, String> connection;
|
private StatefulRedisConnection<String, String> connection;
|
||||||
private RedisStringCommands<String, String> commands;
|
private RedisStringCommands<String, String> commands;
|
||||||
|
private RedisKeyReactiveCommands<String, String> keyReactiveCommands;
|
||||||
|
|
||||||
public void connect() {
|
public void connect() {
|
||||||
this.client = RedisClient.create(this.getConnectionUri());
|
this.client = RedisClient.create(this.getConnectionUri());
|
||||||
this.connection = client.connect();
|
this.connection = client.connect();
|
||||||
this.commands = connection.sync();
|
this.commands = connection.sync();
|
||||||
|
this.keyReactiveCommands = client.connect().reactive();
|
||||||
|
|
||||||
commands.set("test", "im here");
|
this.getKeyReactiveCommands().del("player");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// RedisKeyReactiveCommands
|
Loading…
Reference in New Issue