@Override protected void content(Buffer buffer) throws IOException { if (content == null) { stream = syn(false); content = buffer; } else { stream.getStreamFrameListener().onData(stream, toDataInfo(buffer, false)); } }
@Override protected void onIdleExpired(TimeoutException timeout) { StreamFrameListener listener = this.listener; if (listener != null) listener.onFailure(this, timeout); // The stream is now gone, we must close it to // avoid that its idle timeout is rescheduled. close(); }
private StreamFrameListener notifyOnPush(StreamFrameListener listener, Stream stream, PushInfo pushInfo) { try { if (listener == null) return null; if (LOG.isDebugEnabled()) LOG.debug("Invoking callback with {} on listener {}", pushInfo, listener); return listener.onPush(stream, pushInfo); } catch (Exception x) { LOG.info("Exception while notifying listener " + listener, x); return null; } catch (Error x) { LOG.info("Exception while notifying listener " + listener, x); throw x; } }
private void notifyOnReply(ReplyInfo replyInfo) { final StreamFrameListener listener = this.listener; try { if (listener != null) { if (LOG.isDebugEnabled()) LOG.debug("Invoking reply callback with {} on listener {}", replyInfo, listener); listener.onReply(this, replyInfo); } } catch (Exception x) { LOG.info("Exception while notifying listener " + listener, x); } catch (Error x) { LOG.info("Exception while notifying listener " + listener, x); throw x; } }
private void notifyOnHeaders(HeadersInfo headersInfo) { final StreamFrameListener listener = this.listener; try { if (listener != null) { if (LOG.isDebugEnabled()) LOG.debug("Invoking headers callback with {} on listener {}", headersInfo, listener); listener.onHeaders(this, headersInfo); } } catch (Exception x) { LOG.info("Exception while notifying listener " + listener, x); } catch (Error x) { LOG.info("Exception while notifying listener " + listener, x); throw x; } }
@Override public boolean content(ByteBuffer item) { if (content == null) { stream = syn(false); content = item; } else { stream.getStreamFrameListener().onData(stream, toDataInfo(item, false)); } return false; }
@Override public boolean messageComplete() { if (stream == null) { assert content == null; if (headers.isEmpty()) proxyEngineSelector.onGoAway(session, new GoAwayResultInfo(0, SessionStatus.OK)); else syn(true); } else { stream.getStreamFrameListener().onData(stream, toDataInfo(content, true)); } return false; }
@Override public void messageComplete(long contentLength) throws IOException { if (stream == null) { assert content == null; if (headers.isEmpty()) proxyEngineSelector.onGoAway(session, new GoAwayInfo(0, SessionStatus.OK)); else syn(true); } else { stream.getStreamFrameListener().onData(stream, toDataInfo(content, true)); } headers.clear(); stream = null; content = null; }
private void notifyOnData(DataInfo dataInfo) { final StreamFrameListener listener = this.listener; try { if (listener != null) { if (LOG.isDebugEnabled()) LOG.debug("Invoking data callback with {} on listener {}", dataInfo, listener); listener.onData(this, dataInfo); if (LOG.isDebugEnabled()) LOG.debug("Invoked data callback with {} on listener {}", dataInfo, listener); } } catch (Exception x) { LOG.info("Exception while notifying listener " + listener, x); } catch (Error x) { LOG.info("Exception while notifying listener " + listener, x); throw x; } }