コード例 #1
0
 private void reconnect(final RedisConnection connection, final Channel channel) {
   if (connection.getReconnectListener() != null) {
     // new connection used only for channel init
     RedisConnection rc = new RedisConnection(connection.getRedisClient(), channel);
     Promise<RedisConnection> connectionFuture = bootstrap.group().next().newPromise();
     connection.getReconnectListener().onReconnect(rc, connectionFuture);
     connectionFuture.addListener(
         new FutureListener<RedisConnection>() {
           @Override
           public void operationComplete(Future<RedisConnection> future) throws Exception {
             if (future.isSuccess()) {
               connection.updateChannel(channel);
               resubscribe(connection);
             }
           }
         });
   } else {
     connection.updateChannel(channel);
     resubscribe(connection);
   }
 }