Examples of eventLoop()


Examples of io.netty.channel.Channel.eventLoop()

  public void exceptionCaught(ChannelHandlerContext chctx, final Throwable t) throws Exception {
    final Channel ch = chctx.channel();
    final C sock = connectionMap.remove(ch);
    if (sock != null) {
      DefaultContext context = getContext(sock);
      if (context.isOnCorrectWorker(ch.eventLoop())) {
        try {
          vertx.setContext(context);
          sock.handleException(t);
        } catch (Throwable tt) {
          context.reportException(tt);
View Full Code Here

Examples of io.netty.channel.Channel.eventLoop()

  public void channelInactive(ChannelHandlerContext chctx) throws Exception {
    final Channel ch = chctx.channel();
    final C sock = connectionMap.remove(ch);
    if (sock != null) {
      DefaultContext context = getContext(sock);
      if (context.isOnCorrectWorker(ch.eventLoop())) {
        try {
          vertx.setContext(context);
          sock.handleClosed();
        } catch (Throwable t) {
          context.reportException(t);
View Full Code Here

Examples of io.netty.channel.Channel.eventLoop()

    final C connection = connectionMap.get(ch);
    if (connection != null) {
      DefaultContext context = getContext(connection);
      // We need to do this since it's possible the server is being used from a worker context
      if (context.isOnCorrectWorker(ch.eventLoop())) {
        try {
          vertx.setContext(context);
          doMessageReceived(connection, chctx, msg);
        } catch (Throwable t) {
          context.reportException(t);
View Full Code Here

Examples of io.netty.channel.Channel.eventLoop()

    final DefaultNetSocket sock = connectionMap.get(chctx.channel());
    if (sock != null) {
      Channel ch = chctx.channel();
      DefaultContext context = getContext(sock);
      // We need to do this since it's possible the server is being used from a worker context
      if (context.isOnCorrectWorker(ch.eventLoop())) {
        try {
          vertx.setContext(context);
          sock.handleDataReceived(new Buffer(in.slice()));
        } catch (Throwable t) {
          context.reportException(t);
View Full Code Here

Examples of io.netty.channel.Channel.eventLoop()

    /**
     * Listing 14.5
     */
    public static void scheduleViaEventLoop() {
        Channel ch = null; // Get reference to channel
        ScheduledFuture<?> future = ch.eventLoop().schedule(
                new Runnable() {
                    @Override
                    public void run() {
                        System.out.println("Now its 60 seconds later");
                    }
View Full Code Here

Examples of io.netty.channel.Channel.eventLoop()

    /**
     * Listing 14.6
     */
    public static void scheduleFixedViaEventLoop() {
        Channel ch = null; // Get reference to channel
        ScheduledFuture<?> future = ch.eventLoop().scheduleAtFixedRate(
                new Runnable() {
                    @Override
                    public void run() {
                        System.out.println("Run every 60 seconds");
                    }
View Full Code Here

Examples of io.netty.channel.Channel.eventLoop()

    /**
     * Listing 14.1
     */
    public static void executeTaskInEventLoop() {
        Channel channel = null; // get reference to channel
        channel.eventLoop().execute(new Runnable() {
            @Override
            public void run() {
                System.out.println("Run in the EventLoop");
            }
        });
View Full Code Here

Examples of io.netty.channel.Channel.eventLoop()

    /**
     * Listing 14.2
     */
    public static void executeTaskInEventLoopAndCheck() {
        Channel channel = null; // get reference to channel
        Future<?> future = channel.eventLoop().submit(new Runnable() {
            @Override
            public void run() {
                // Do something
            }
        });
View Full Code Here

Examples of io.netty.channel.Channel.eventLoop()

    /**
     * Listing 14.3
     */
    public static void checkIfInEventLoop() {
        Channel channel = null; // get reference to channel
        if (channel.eventLoop().inEventLoop()) {
            System.out.println("In the EventLoop");
        } else {
            System.out.println("Outside the EventLoop");
        }
    }
View Full Code Here

Examples of io.netty.channel.Channel.eventLoop()

            for (int i = 0; i < TOTAL_CNT;) {
                final int start = i;
                final int end = i + ELEMS_PER_ROUNDS;
                i = end;

                ch.eventLoop().execute(new Runnable() {
                    @Override
                    public void run() {
                        for (int j = start; j < end; j ++) {
                            ch.pipeline().fireChannelRead(Integer.valueOf(j));
                        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.