@Override public void failed(Throwable x) { notifyCallbackFailure(current.callback, x); // If something went wrong, very likely the compression context // will be invalid, so we need to fail this IteratingCallback. LOG.warn("flush frame failed", x); super.failed(x); }
throw new IllegalStateException(toString()); processing();
/** * Invoked when the sub task fails. Subclasses that override this method * must always remember to call {@code super.failed(Throwable)}. */ @Override public void failed(Throwable x) { boolean failure = false; try (Locker.Lock lock = _locker.lock()) { switch (_state) { case SUCCEEDED: case FAILED: case IDLE: case CLOSED: case CALLED: // too late!. break; case PENDING: case PROCESSING: { _state = State.FAILED; failure = true; break; } default: throw new IllegalStateException(toString()); } } if (failure) onCompleteFailure(x); }
action = process(); } catch (Throwable x) { failed(x); break; onCompleteSuccess();
@Override public String toString() { return String.format("%s[window_queue=%d,frame_queue=%d,actives=%d]", super.toString(), getWindowQueueSize(), getFrameQueueSize(), actives.size()); }
public void close() { boolean failure = false; try (Locker.Lock lock = _locker.lock()) { switch (_state) { case IDLE: case SUCCEEDED: case FAILED: _state = State.CLOSED; break; case CLOSED: break; default: _state = State.CLOSED; failure = true; } } if (failure) onCompleteFailure(new ClosedChannelException()); }
@Override public void outgoingFrame(Frame frame, Callback callback) { // We use a queue and an IteratingCallback to handle concurrency. // We must compress and write atomically, otherwise the compression // context on the other end gets confused. if (flusher.isFailed()) { notifyCallbackFailure(callback, new ZipException()); return; } FrameEntry entry = new FrameEntry(frame, callback); if (LOG.isDebugEnabled()) LOG.debug("Queuing {}", entry); offerEntry(entry); flusher.iterate(); }
@Override public void succeeded() { if (log.isDebugEnabled()) { log.debug("Written {} frames for {}", actives.size(), actives.toString()); } complete(); super.succeeded(); }
@Override public void outgoingFrame(Frame frame, Callback callback) { ByteBuffer payload = frame.getPayload(); int length = payload != null ? payload.remaining() : 0; if (OpCode.isControlFrame(frame.getOpCode()) || maxLength <= 0 || length <= maxLength) { nextOutgoingFrame(frame, callback); return; } FrameEntry entry = new FrameEntry(frame, callback); if (LOG.isDebugEnabled()) LOG.debug("Queuing {}", entry); offerEntry(entry); flusher.iterate(); }
action = process(); } catch (Throwable x) { failed(x); break processing; onCompleteSuccess();
@Override public String toString() { return String.format("%s[window_queue=%d,frame_queue=%d,actives=%d]", super.toString(), getWindowQueueSize(), getFrameQueueSize(), actives.size()); }
public void close() { boolean failure = false; try (Locker.Lock lock = _locker.lock()) { switch (_state) { case IDLE: case SUCCEEDED: case FAILED: _state = State.CLOSED; break; case CLOSED: break; default: _state = State.CLOSED; failure = true; } } if (failure) onCompleteFailure(new ClosedChannelException()); }
@Override public void outgoingFrame(Frame frame, Callback callback) { // We use a queue and an IteratingCallback to handle concurrency. // We must compress and write atomically, otherwise the compression // context on the other end gets confused. if (flusher.isFailed()) { notifyCallbackFailure(callback, new ZipException()); return; } FrameEntry entry = new FrameEntry(frame, callback); if (LOG.isDebugEnabled()) LOG.debug("Queuing {}", entry); offerEntry(entry); flusher.iterate(); }
@Override public void succeeded() { if (finished) notifyCallbackSuccess(current.callback); super.succeeded(); }
@Override public void outgoingFrame(Frame frame, Callback callback) { ByteBuffer payload = frame.getPayload(); int length = payload != null ? payload.remaining() : 0; if (OpCode.isControlFrame(frame.getOpCode()) || maxLength <= 0 || length <= maxLength) { nextOutgoingFrame(frame, callback); return; } FrameEntry entry = new FrameEntry(frame, callback); if (LOG.isDebugEnabled()) LOG.debug("Queuing {}", entry); offerEntry(entry); flusher.iterate(); }
throw new IllegalStateException(toString()); processing();
action = process(); } catch (Throwable x) { failed(x); break; onCompleteSuccess();
/** * Invoked when the sub task fails. * Subclasses that override this method must always remember to call * {@code super.failed(Throwable)}. */ @Override public void failed(Throwable x) { boolean failure = false; try (Locker.Lock lock = _locker.lock()) { switch (_state) { case SUCCEEDED: case FAILED: case IDLE: case CLOSED: case CALLED: // too late!. break; case PENDING: case PROCESSING: { _state = State.FAILED; failure = true; break; } default: throw new IllegalStateException(toString()); } } if (failure) onCompleteFailure(x); }
@Override public void failed(Throwable x) { notifyCallbackFailure(current.callback, x); // If something went wrong, very likely the compression context // will be invalid, so we need to fail this IteratingCallback. LOG.warn("flush frame failed", x); super.failed(x); }
public void close() { boolean failure = false; try (Locker.Lock lock = _locker.lock()) { switch (_state) { case IDLE: case SUCCEEDED: case FAILED: _state = State.CLOSED; break; case CLOSED: break; default: _state = State.CLOSED; failure = true; } } if (failure) onCompleteFailure(new ClosedChannelException()); }