@Override public void startResponse(HttpResponse response) throws Exception { try { if (LOG.isTraceEnabled()) LOG.trace("started response for /stream"); _decorated = new ChunkedBodyReadableByteChannel(); super.startResponse(response); if (!_errorHandled) { _stateReuse.switchToStreamSuccess(_decorated); _callback.enqueueMessage(_stateReuse); } } catch (Exception e) { LOG.error("Error reading events from server", e); if (!_errorHandled) { _stateReuse.switchToStreamResponseError(); _callback.enqueueMessage(_stateReuse); } } }
@Override public void handleChannelException(Throwable cause) { DbusPrettyLogUtils.logExceptionAtError("Exception during /stream response: ", cause, LOG); if ((_responseStatus != ResponseStatus.CHUNKS_SEEN) && (_responseStatus != ResponseStatus.CHUNKS_FINISHED)) { if (LOG.isDebugEnabled()) { LOG.debug("Enqueueing /stream response error state to puller queue"); } _stateReuse.switchToStreamResponseError(); _callback.enqueueMessage(_stateReuse); } else { if (LOG.isDebugEnabled()) { LOG.debug("Skipping enqueueing /stream response error state to puller queue"); } } super.handleChannelException(cause); }