Example usage for io.netty.channel ChannelPromise isVoid

List of usage examples for io.netty.channel ChannelPromise isVoid

Introduction

In this page you can find the example usage for io.netty.channel ChannelPromise isVoid.

Prototype

boolean isVoid();

Source Link

Document

Returns true if this ChannelFuture is a void future and so not allow to call any of the following methods:
  • #addListener(GenericFutureListener)
  • #addListeners(GenericFutureListener[])
  • #await()
  • #await(long,TimeUnit) ()}
  • #await(long) ()}
  • #awaitUninterruptibly()
  • #sync()
  • #syncUninterruptibly()

Usage

From source file:io.lettuce.core.protocol.CommandHandler.java

License:Apache License

private void addToStack(RedisCommand<?, ?, ?> command, ChannelPromise promise) {

    try {/* w  w  w .  java  2  s. c  o  m*/

        validateWrite(1);

        if (command.getOutput() == null) {
            // fire&forget commands are excluded from metrics
            complete(command);
        }

        RedisCommand<?, ?, ?> redisCommand = potentiallyWrapLatencyCommand(command);

        if (promise.isVoid()) {
            stack.add(redisCommand);
        } else {
            promise.addListener(AddToStack.newInstance(stack, command));
        }
    } catch (Exception e) {
        command.completeExceptionally(e);
        throw e;
    }
}

From source file:org.jupiter.transport.netty.handler.IdleStateChecker.java

License:Apache License

@Override
public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception {
    if (writerIdleTimeMillis > 0 || allIdleTimeMillis > 0) {
        if (promise.isVoid()) {
            firstWriterIdleEvent = firstAllIdleEvent = true;
            lastWriteTime = SystemClock.millisClock().now(); // make hb for firstWriterIdleEvent and firstAllIdleEvent
        } else {/*from  www.  java 2 s  .co  m*/
            promise.addListener(writeListener);
        }
    }
    ctx.write(msg, promise);
}