Examples of VoidHandler


Examples of io.vertx.core.VoidHandler

      for (;;) {
        final Buffer buf = pendingData.poll();
        if (buf == null) {
          break;
        }
        vertx.runOnContext(new VoidHandler() {
          @Override
          protected void handle() {
            handleDataReceived(buf);
          }
        });
View Full Code Here

Examples of io.vertx.core.VoidHandler

  @Override
  public HttpClientResponse bodyHandler(final Handler<Buffer> bodyHandler) {
    BodyHandler handler = new BodyHandler();
    handler(handler);
    endHandler(new VoidHandler() {
      public void handle() {
        handler.notifyHandler(bodyHandler);
      }
    });
    return this;
View Full Code Here

Examples of io.vertx.core.VoidHandler

  private void doResume() {
    if (pausedChunks != null) {
      Buffer chunk;
      while ((chunk = pausedChunks.poll()) != null) {
        final Buffer theChunk = chunk;
        vertx.runOnContext(new VoidHandler() {
          @Override
          protected void handle() {
            handleChunk(theChunk);
          }
        });
      }
    }
    if (hasPausedEnd) {
      final LastHttpContent theTrailer = pausedTrailer;
      vertx.runOnContext(new VoidHandler() {
        @Override
        protected void handle() {
          handleEnd(theTrailer);
        }
      });
View Full Code Here

Examples of io.vertx.core.VoidHandler

  private void checkNextTick() {
    // Check if there are more pending messages in the queue that can be processed next time around
    if (!pending.isEmpty() && !sentCheck && !paused && (pendingResponse == null || pending.peek() instanceof HttpContent)) {
      sentCheck = true;
      vertx.runOnContext(new VoidHandler() {
        public void handle() {
          sentCheck = false;
          if (!paused) {
            Object msg = pending.poll();
            if (msg != null) {
View Full Code Here

Examples of org.vertx.java.core.VoidHandler

  @Override
  public DefaultConnectionOutputGroup group(final String name, final Object args, final Handler<OutputGroup> handler) {
    DefaultConnectionOutputGroup group = connection.group(name, args, id, handler);
    children++;
    group.endHandler(new VoidHandler() {
      @Override
      protected void handle() {
        children--;
        checkEnd();
      }
View Full Code Here

Examples of org.vertx.java.core.VoidHandler

  @Override
  public OutputConnection group(String name, Object args, Handler<OutputGroup> handler) {
    DefaultConnectionOutputGroup group = connection.group(name, args, id, handler);
    children++;
    group.endHandler(new VoidHandler() {
      @Override
      protected void handle() {
        children--;
        checkEnd();
      }
View Full Code Here

Examples of org.vertx.java.core.VoidHandler

          // Serve the index page
          req.response().sendFile("simpleform/index.html");
        } else if (req.uri().startsWith("/form")) {
          req.response().setChunked(true);
          req.expectMultiPart(true);
          req.endHandler(new VoidHandler() {
            protected void handle() {
              for (Map.Entry<String, String> entry : req.formAttributes()) {
                req.response().write("Got attr " + entry.getKey() + " : " + entry.getValue() + "\n");
              }
              req.response().end();
View Full Code Here

Examples of org.vertx.java.core.VoidHandler

          startWebSocket();
        }
      }
    });
    if (count + 1 < CONNS) {
      vertx.runOnContext(new VoidHandler() {
        public void handle() {
          connect(count + 1);
        }
      });
    }
View Full Code Here

Examples of org.vertx.java.core.VoidHandler

  private void startWebSocket() {
    WebSocket ws = websockets.poll();
    writeWebSocket(ws);
    if (!websockets.isEmpty()) {
      vertx.runOnContext(new VoidHandler() {
        public void handle() {
          startWebSocket();
        }
      });
    }
View Full Code Here

Examples of org.vertx.java.core.VoidHandler

  private void writeWebSocket(final WebSocket ws) {
    if (!ws.writeQueueFull()) {
      //ws.writeTextFrame(message);
      ws.writeBinaryFrame(new Buffer(message));
      vertx.runOnContext(new VoidHandler() {
        public void handle() {
          writeWebSocket(ws);
        }
      });
    } else {
      // Flow control
      ws.drainHandler(new VoidHandler() {
        public void handle() {
          writeWebSocket(ws);
        }
      });
    }
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.