Ejemplo n.º 1
0
 /**
  * This method sets a drain handler {@code handler} on the request. The drain handler will be
  * called when write queue is no longer full and it is safe to write to it again.
  *
  * <p>The drain handler is actually called when the write queue size reaches <b>half</b> the write
  * queue max size to prevent thrashing. This method is used as part of a flow control strategy,
  * e.g. it is used by the {@link org.vertx.java.core.streams.Pump} class to pump data between
  * different streams.
  *
  * @param handler
  */
 public void drainHandler(Handler<Void> handler) {
   check();
   this.drainHandler = handler;
   if (conn != null) {
     conn.handleInterestedOpsChanged(); // If the channel is already drained, we want to call it
     // immediately
   }
 }
Ejemplo n.º 2
0
 @Override
 public HttpClientRequest drainHandler(Handler<Void> handler) {
   synchronized (getLock()) {
     checkComplete();
     this.drainHandler = handler;
     if (conn != null) {
       conn.getContext().runOnContext(v -> conn.handleInterestedOpsChanged());
     }
     return this;
   }
 }