Tabnine Logo
ChannelHandlerContext.executor
Code IndexAdd Tabnine to your IDE (free)

How to use
executor
method
in
io.netty.channel.ChannelHandlerContext

Best Java code snippets using io.netty.channel.ChannelHandlerContext.executor (Showing top 20 results out of 954)

Refine searchRefine arrow

  • EventExecutor.inEventLoop
  • EventExecutor.schedule
origin: apache/incubator-dubbo

@Override
public void channelActive(final ChannelHandlerContext ctx) throws Exception {
  welcomeFuture = ctx.executor().schedule(new Runnable() {
    @Override
    public void run() {
      if (welcome != null) {
        ctx.write(Unpooled.wrappedBuffer(welcome.getBytes()));
        ctx.writeAndFlush(Unpooled.wrappedBuffer(prompt.getBytes()));
      }
    }
  }, 500, TimeUnit.MILLISECONDS);
}
origin: netty/netty

/**
 * Returns {@code true} if there are no pending write operations left in this queue.
 */
public boolean isEmpty() {
  assert ctx.executor().inEventLoop();
  return head == null;
}
origin: netty/netty

/**
 * Returns the number of pending write operations.
 */
public int size() {
  assert ctx.executor().inEventLoop();
  return size;
}
origin: apache/incubator-dubbo

@Override
public void channelActive(final ChannelHandlerContext ctx) throws Exception {
  welcomeFuture = ctx.executor().schedule(new Runnable() {
    @Override
    public void run() {
      if (welcome != null) {
        ctx.write(Unpooled.wrappedBuffer(welcome.getBytes()));
        ctx.writeAndFlush(Unpooled.wrappedBuffer(prompt.getBytes()));
      }
    }
  }, 500, TimeUnit.MILLISECONDS);
}
origin: netty/netty

/**
 * Return the current message or {@code null} if empty.
 */
public Object current() {
  assert ctx.executor().inEventLoop();
  PendingWrite write = head;
  if (write == null) {
    return null;
  }
  return write.msg;
}
origin: redisson/redisson

/**
 * This method is visible for testing!
 */
ScheduledFuture<?> schedule(ChannelHandlerContext ctx, Runnable task, long delay, TimeUnit unit) {
  return ctx.executor().schedule(task, delay, unit);
}
origin: netty/netty

/**
 * Returns the total number of bytes that are pending because of pending messages. This is only an estimate so
 * it should only be treated as a hint.
 */
public long bytes() {
  assert ctx.executor().inEventLoop();
  return bytes;
}
origin: wildfly/wildfly

ClosingChannelFutureListener(final ChannelHandlerContext ctx, final ChannelPromise promise,
               long timeout, TimeUnit unit) {
  this.ctx = ctx;
  this.promise = promise;
  timeoutTask = ctx.executor().schedule(new Runnable() {
    @Override
    public void run() {
      ctx.close(promise);
    }
  }, timeout, unit);
}
origin: redisson/redisson

/**
 * Returns {@code true} if there are no pending write operations left in this queue.
 */
public boolean isEmpty() {
  assert ctx.executor().inEventLoop();
  return head == null;
}
origin: wildfly/wildfly

/**
 * This method is visible for testing!
 */
ScheduledFuture<?> schedule(ChannelHandlerContext ctx, Runnable task, long delay, TimeUnit unit) {
  return ctx.executor().schedule(task, delay, unit);
}
origin: redisson/redisson

/**
 * Returns the number of pending write operations.
 */
public int size() {
  assert ctx.executor().inEventLoop();
  return size;
}
origin: ReactiveX/RxNetty

private ScheduledFuture<?> _scheduleNextTask(ChannelHandlerContext ctx, ReadTimeoutTask task, long timeoutNanos) {
  try {
    return ctx.executor().schedule(task, timeoutNanos, TimeUnit.NANOSECONDS);
  } catch (Exception e) {
    logger.error("Failed to schedule read timeout task. Read timeout will not work on channel: "
           + ctx.channel(), e);
    throw e;
  }
}
origin: redisson/redisson

/**
 * Return the current message or {@code null} if empty.
 */
public Object current() {
  assert ctx.executor().inEventLoop();
  PendingWrite write = head;
  if (write == null) {
    return null;
  }
  return write.msg;
}
origin: apache/rocketmq-externals

private void initialize(ChannelHandlerContext ctx) {
  if (state.get() != State.NONE) {
    return;
  }
  state.set(State.INITIALIZED);
  EventExecutor loop = ctx.executor();
  lastReadTimeNanos = lastWriteTimeNanos = System.nanoTime();
  if (allIdleTimeNanos > 0) {
    loop.schedule(new AllIdleTimeoutTask(ctx), allIdleTimeNanos, TimeUnit.SECONDS);
  }
}
origin: redisson/redisson

/**
 * Returns the total number of bytes that are pending because of pending messages. This is only an estimate so
 * it should only be treated as a hint.
 */
public long bytes() {
  assert ctx.executor().inEventLoop();
  return bytes;
}
origin: redisson/redisson

private void scheduleTimeout(final ChannelHandlerContext ctx, final ChannelPromise promise) {
  // Schedule a timeout.
  final WriteTimeoutTask task = new WriteTimeoutTask(ctx, promise);
  task.scheduledFuture = ctx.executor().schedule(task, timeoutNanos, TimeUnit.NANOSECONDS);
  if (!task.scheduledFuture.isDone()) {
    addWriteTimeoutTask(task);
    // Cancel the scheduled timeout if the flush promise is complete.
    promise.addListener(task);
  }
}
origin: wildfly/wildfly

/**
 * Returns {@code true} if there are no pending write operations left in this queue.
 */
public boolean isEmpty() {
  assert ctx.executor().inEventLoop();
  return head == null;
}
origin: Netflix/zuul

private void requestClientToCloseConnection() {
  if (ctx.channel().isActive()) {
    // Application level protocol for asking client to close connection
    ctx.writeAndFlush(pushProtocol.goAwayMessage());
    // Force close connection if client doesn't close in reasonable time after we made request
    ctx.executor().schedule(() -> forceCloseConnectionFromServerSide(), CLIENT_CLOSE_GRACE_PERIOD.get(), TimeUnit.SECONDS);
  } else {
    forceCloseConnectionFromServerSide();
  }
}
origin: wildfly/wildfly

@Override
public void window(int initialWindowSize) {
  assert ctx == null || ctx.executor().inEventLoop();
  window = processedWindow = initialStreamWindowSize = initialWindowSize;
}
origin: netty/netty

@Override
public void close(final ChannelHandlerContext ctx, final ChannelPromise promise) throws Exception {
  ChannelFuture f = finishEncode(ctx, ctx.newPromise());
  f.addListener(new ChannelFutureListener() {
    @Override
    public void operationComplete(ChannelFuture f) throws Exception {
      ctx.close(promise);
    }
  });
  if (!f.isDone()) {
    // Ensure the channel is closed even if the write operation completes in time.
    ctx.executor().schedule(new Runnable() {
      @Override
      public void run() {
        ctx.close(promise);
      }
    }, 10, TimeUnit.SECONDS); // FIXME: Magic number
  }
}
io.netty.channelChannelHandlerContextexecutor

Javadoc

Returns the EventExecutor which is used to execute an arbitrary task.

Popular methods of ChannelHandlerContext

  • channel
    Return the Channel which is bound to the ChannelHandlerContext.
  • close
  • writeAndFlush
  • write
  • flush
  • fireChannelRead
  • pipeline
    Return the assigned ChannelPipeline
  • alloc
    Return the assigned ByteBufAllocator which will be used to allocate ByteBufs.
  • fireExceptionCaught
  • fireUserEventTriggered
  • newPromise
  • fireChannelActive
  • newPromise,
  • fireChannelActive,
  • fireChannelInactive,
  • voidPromise,
  • read,
  • fireChannelReadComplete,
  • name,
  • attr,
  • disconnect

Popular in Java

  • Updating database using SQL prepared statement
  • compareTo (BigDecimal)
  • putExtra (Intent)
  • runOnUiThread (Activity)
  • EOFException (java.io)
    Thrown when a program encounters the end of a file or stream during an input operation.
  • FileWriter (java.io)
    A specialized Writer that writes to a file in the file system. All write requests made by calling me
  • HttpURLConnection (java.net)
    An URLConnection for HTTP (RFC 2616 [http://tools.ietf.org/html/rfc2616]) used to send and receive d
  • URI (java.net)
    A Uniform Resource Identifier that identifies an abstract or physical resource, as specified by RFC
  • Handler (java.util.logging)
    A Handler object accepts a logging request and exports the desired messages to a target, for example
  • JPanel (javax.swing)
  • Sublime Text for Python
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now