fixed merge created issue

two methods got removed after merge and did not realise.
pull/509/head
jackygurui 9 years ago
parent e3debdb158
commit d876dc8438

@ -37,9 +37,12 @@ import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.SocketChannel;
import io.netty.channel.socket.nio.NioSocketChannel;
import io.netty.util.concurrent.Future;
import io.netty.util.concurrent.GenericFutureListener;
import io.netty.util.concurrent.GlobalEventExecutor;
import io.netty.util.concurrent.ImmediateEventExecutor;
import io.netty.util.concurrent.Promise;
import java.util.Map;
import org.redisson.client.protocol.RedisCommands;
public class RedisClient {
@ -150,6 +153,37 @@ public class RedisClient {
return channels.close();
}
/**
* Execute INFO SERVER operation.
*
* @return Map extracted from each response line splitting by ':' symbol
*/
public Map<String, String> serverInfo() {
try {
return serverInfoAsync().sync().get();
} catch (Exception e) {
throw new RedisConnectionException("Unable to retrieve server into from: " + addr, e);
}
}
/**
* Asynchronously execute INFO SERVER operation.
*
* @return A future for a map extracted from each response line splitting by
* ':' symbol
*/
public Future<Map<String, String>> serverInfoAsync() {
final RedisConnection connection = connect();
Promise<Map<String, String>> async = (Promise) connection.async(RedisCommands.SERVER_INFO);
async.addListener(new GenericFutureListener<Promise<Map<String, String>>>() {
@Override
public void operationComplete(Promise<Map<String, String>> future) throws Exception {
connection.closeAsync();
}
});
return async;
}
@Override
public String toString() {
return "[addr=" + addr + "]";

Loading…
Cancel
Save