/** * Explicitly flush the buffer, even if it is not full. * @return true if the flush succeeds, false if the delegate throws {@code CallbackRefusedException} */ public boolean commit() { try { commitInternal(); return true; } catch (CallbackRefusedException e) { return false; } }
/** * Add an item to the buffer. May cause a commit if the buffer is full. * @throws CallbackRefusedException if the delegate throws. */ @Override public void call(T item) throws CallbackRefusedException { while (!list.offer(item)) { commitInternal(); } }