예제 #1
0
 public <T> T await(Command<K, V, T> cmd, long timeout, TimeUnit unit) {
   if (!cmd.await(timeout, unit)) {
     cmd.cancel(true);
     throw new RedisException("Command timed out");
   }
   CommandOutput<K, V, T> output = cmd.getOutput();
   if (output.hasError()) throw new RedisException(output.getError());
   return output.get();
 }
예제 #2
0
 @Override
 public synchronized void channelClosed(ChannelHandlerContext ctx, ChannelStateEvent e)
     throws Exception {
   if (closed) {
     for (Command<K, V, ?> cmd : queue) {
       cmd.getOutput().setError("Connection closed");
       cmd.complete();
     }
     queue.clear();
     queue = null;
     channel = null;
   }
 }