private boolean writeUntilFullOrDone(final Connection c) throws IOException { while (c.canWrite()) { if (isReady()) { canFeed(); } else { return true; } } return false; }
/** * 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); } }
@Override public boolean canWrite() { return connection.getConnection().canWrite(); }
@Override public boolean canWrite() { return connection.getConnection().canWrite(); }
@Override public boolean canWrite() { return connection.getConnection().canWrite(); }
@Override public boolean canWrite() { return connection.getConnection().canWrite(); }
@Override public boolean canWrite() { return connection.getConnection().canWrite(); }
@Override public boolean canWrite() { return connection.getConnection().canWrite(); }
@Override public boolean canWrite() { return connection.getConnection().canWrite(); }
@Override public boolean canWrite() { return connection.getConnection().canWrite(); }
@Override public boolean canWrite() { return connection.getConnection().canWrite(); }
@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; } }
@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; } }
private boolean writeUntilFullOrDone(final Connection c) throws IOException { while (c.canWrite()) { if (isReady()) { canFeed(); } else { return true; } } return false; }
private boolean writeUntilFullOrDone(final Connection c) throws IOException { while (c.canWrite()) { if (isReady()) { canFeed(); } else { return true; } } return false; }
private boolean writeUntilFullOrDone(final Connection c) throws IOException { while (c.canWrite()) { if (isReady()) { canFeed(); } else { return true; } } return false; }
private boolean writeUntilFullOrDone(final Connection c) throws IOException { while (c.canWrite()) { if (isReady()) { canFeed(); } else { return true; } } return false; }
/** * 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); } }
/** * 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); } }
/** * 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); } }