@Override public synchronized void flush() throws IOException { final Connection c = feedableBodyGenerator.context.getConnection(); if (isReady()) { boolean notReady = writeUntilFullOrDone(c); if (!isDone()) { if (notReady) { notifyReadyToFeed(new ReadyToFeedListenerImpl()); } else { // write queue is full, leverage WriteListener to let us know // when it is safe to write again. c.notifyCanWrite(new WriteHandlerImpl()); } } } else { notifyReadyToFeed(new ReadyToFeedListenerImpl()); } }
@Override public synchronized void flush() throws IOException { final Connection c = feedableBodyGenerator.context.getConnection(); if (isReady()) { boolean notReady = writeUntilFullOrDone(c); if (!isDone()) { if (notReady) { notifyReadyToFeed(new ReadyToFeedListenerImpl()); } else { // write queue is full, leverage WriteListener to let us know // when it is safe to write again. c.notifyCanWrite(new WriteHandlerImpl()); } } } else { notifyReadyToFeed(new ReadyToFeedListenerImpl()); } }
@Override public synchronized void flush() throws IOException { final Connection c = feedableBodyGenerator.context.getConnection(); if (isReady()) { boolean notReady = writeUntilFullOrDone(c); if (!isDone()) { if (notReady) { notifyReadyToFeed(new ReadyToFeedListenerImpl()); } else { // write queue is full, leverage WriteListener to let us know // when it is safe to write again. c.notifyCanWrite(new WriteHandlerImpl()); } } } else { notifyReadyToFeed(new ReadyToFeedListenerImpl()); } }
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; }
@Override public synchronized void flush() throws IOException { final Connection c = feedableBodyGenerator.context.getConnection(); if (isReady()) { boolean notReady = writeUntilFullOrDone(c); if (!isDone()) { if (notReady) { notifyReadyToFeed(new ReadyToFeedListenerImpl()); } else { // write queue is full, leverage WriteListener to let us know // when it is safe to write again. c.notifyCanWrite(new WriteHandlerImpl()); } } } else { notifyReadyToFeed(new ReadyToFeedListenerImpl()); } }
private boolean writeUntilFullOrDone(final Connection c) throws IOException { while (c.canWrite()) { if (isReady()) { canFeed(); } else { return true; } } return false; }