org.glassfish.grizzly.Connection.canWrite()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(6.0k)|赞(0)|评价(0)|浏览(97)

本文整理了Java中org.glassfish.grizzly.Connection.canWrite()方法的一些代码示例,展示了Connection.canWrite()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Connection.canWrite()方法的具体详情如下:
包路径:org.glassfish.grizzly.Connection
类名称:Connection
方法名:canWrite

Connection.canWrite介绍

暂无

代码示例

代码示例来源:origin: com.ning/async-http-client

private boolean writeUntilFullOrDone(final Connection c) throws IOException {
  while (c.canWrite()) {
    if (isReady()) {
      canFeed();
    } else {
      return true;
    }
  }
  
  return false;
}

代码示例来源:origin: com.ning/async-http-client

/**
 * This method will block if the async write queue is currently larger
 * than the configured maximum.  The amount of time that this method
 * will block is dependent on the write timeout of the transport
 * associated with the specified connection.
 */
private static void blockUntilQueueFree(final Connection c) {
  if (!c.canWrite()) {
    final FutureImpl<Boolean> future =
        Futures.createSafeFuture();
    // Connection may be obtained by calling FilterChainContext.getConnection().
    c.notifyCanWrite(new WriteHandler() {
      @Override
      public void onWritePossible() throws Exception {
        future.result(TRUE);
      }
      @Override
      public void onError(Throwable t) {
        future.failure(makeIOException(t));
      }
    });
    block(c, future);
  }
}

代码示例来源:origin: javaee/grizzly

@Override
public boolean canWrite() {
  return connection.getConnection().canWrite();
}

代码示例来源:origin: javaee/grizzly

@Override
public boolean canWrite() {
  return connection.getConnection().canWrite();
}

代码示例来源:origin: org.glassfish.grizzly/grizzly-websockets-server

@Override
public boolean canWrite() {
  return connection.getConnection().canWrite();
}

代码示例来源:origin: javaee/grizzly

@Override
public boolean canWrite() {
  return connection.getConnection().canWrite();
}

代码示例来源:origin: javaee/grizzly

@Override
public boolean canWrite() {
  return connection.getConnection().canWrite();
}

代码示例来源:origin: org.glassfish.grizzly/grizzly-http-server-core

@Override
public boolean canWrite() {
  return connection.getConnection().canWrite();
}

代码示例来源:origin: javaee/grizzly

@Override
public boolean canWrite() {
  return connection.getConnection().canWrite();
}

代码示例来源:origin: javaee/grizzly

@Override
public boolean canWrite() {
  return connection.getConnection().canWrite();
}

代码示例来源:origin: org.glassfish.grizzly/grizzly-http2

@Override
public boolean canWrite() {
  return connection.getConnection().canWrite();
}

代码示例来源:origin: eclipse-ee4j/tyrus

@Override
  public boolean isValid() {
    if (!connection.canWrite() && writeHandlerRegistered.compareAndSet(false, true)) {
      connection.notifyCanWrite(new WriteHandler() {
        @Override
        public void onWritePossible() throws Exception {
          writeHandlerRegistered.set(false);
          taskProcessor.processTask();
        }
        @Override
        public void onError(Throwable t) {
          writeHandlerRegistered.set(false);
          Logger.getLogger(GrizzlyWriter.class.getName()).log(Level.WARNING, t.getMessage(), t);
          // TODO: do what?
        }
      });
      return false;
    }
    return true;
  }
}

代码示例来源:origin: org.glassfish.tyrus/tyrus-container-grizzly-client

@Override
  public boolean isValid() {
    if (!connection.canWrite() && writeHandlerRegistered.compareAndSet(false, true)) {
      connection.notifyCanWrite(new WriteHandler() {
        @Override
        public void onWritePossible() throws Exception {
          writeHandlerRegistered.set(false);
          taskProcessor.processTask();
        }
        @Override
        public void onError(Throwable t) {
          writeHandlerRegistered.set(false);
          Logger.getLogger(GrizzlyWriter.class.getName()).log(Level.WARNING, t.getMessage(), t);
          // TODO: do what?
        }
      });
      return false;
    }
    return true;
  }
}

代码示例来源:origin: io.gatling/async-http-client

private boolean writeUntilFullOrDone(final Connection c) throws IOException {
  while (c.canWrite()) {
    if (isReady()) {
      canFeed();
    } else {
      return true;
    }
  }
  
  return false;
}

代码示例来源:origin: javaee/grizzly-ahc

private boolean writeUntilFullOrDone(final Connection c) throws IOException {
  while (c.canWrite()) {
    if (isReady()) {
      canFeed();
    } else {
      return true;
    }
  }
  
  return false;
}

代码示例来源:origin: org.glassfish.grizzly/grizzly-http-client

private boolean writeUntilFullOrDone(final Connection c) throws IOException {
  while (c.canWrite()) {
    if (isReady()) {
      canFeed();
    } else {
      return true;
    }
  }
  
  return false;
}

代码示例来源:origin: org.apache.apex/apex-shaded-ning19

private boolean writeUntilFullOrDone(final Connection c) throws IOException {
  while (c.canWrite()) {
    if (isReady()) {
      canFeed();
    } else {
      return true;
    }
  }
  
  return false;
}

代码示例来源:origin: org.glassfish.grizzly/grizzly-http-client

/**
 * This method will block if the async write queue is currently larger
 * than the configured maximum.  The amount of time that this method
 * will block is dependent on the write timeout of the transport
 * associated with the specified connection.
 */
private static void blockUntilQueueFree(final Connection c) {
  if (!c.canWrite()) {
    final FutureImpl<Boolean> future =
        Futures.createSafeFuture();
    // Connection may be obtained by calling FilterChainContext.getConnection().
    c.notifyCanWrite(new WriteHandler() {
      @Override
      public void onWritePossible() throws Exception {
        future.result(TRUE);
      }
      @Override
      public void onError(Throwable t) {
        future.failure(makeIOException(t));
      }
    });
    block(c, future);
  }
}

代码示例来源:origin: org.apache.apex/apex-shaded-ning19

/**
 * This method will block if the async write queue is currently larger
 * than the configured maximum.  The amount of time that this method
 * will block is dependent on the write timeout of the transport
 * associated with the specified connection.
 */
private static void blockUntilQueueFree(final Connection c) {
  if (!c.canWrite()) {
    final FutureImpl<Boolean> future =
        Futures.createSafeFuture();
    // Connection may be obtained by calling FilterChainContext.getConnection().
    c.notifyCanWrite(new WriteHandler() {
      @Override
      public void onWritePossible() throws Exception {
        future.result(TRUE);
      }
      @Override
      public void onError(Throwable t) {
        future.failure(makeIOException(t));
      }
    });
    block(c, future);
  }
}

代码示例来源:origin: io.gatling/async-http-client

/**
 * This method will block if the async write queue is currently larger
 * than the configured maximum.  The amount of time that this method
 * will block is dependent on the write timeout of the transport
 * associated with the specified connection.
 */
private static void blockUntilQueueFree(final Connection c) {
  if (!c.canWrite()) {
    final FutureImpl<Boolean> future =
        Futures.createSafeFuture();
    // Connection may be obtained by calling FilterChainContext.getConnection().
    c.notifyCanWrite(new WriteHandler() {
      @Override
      public void onWritePossible() throws Exception {
        future.result(TRUE);
      }
      @Override
      public void onError(Throwable t) {
        future.failure(makeIOException(t));
      }
    });
    block(c, future);
  }
}

相关文章

微信公众号

最新文章

更多