List of usage examples for io.netty.channel ChannelPromise isVoid
boolean isVoid();
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); }