Or I could just simply show a patch:
Index: src/main/java/org/apache/http/nio/protocol/HttpAsyncService.java
===================================================================
--- src/main/java/org/apache/http/nio/protocol/HttpAsyncService.java (revision
1793912)
+++ src/main/java/org/apache/http/nio/protocol/HttpAsyncService.java (working
copy)
@@ -277,10 +277,10 @@
@Override
public void exception(
final NHttpServerConnection conn, final Exception cause) {
+ log(cause);
final State state = getState(conn);
if (state == null) {
shutdownConnection(conn);
- log(cause);
return;
}
state.setTerminated();
Gary
On Sat, May 6, 2017 at 1:46 AM, Oleg Kalnichevski <[email protected]> wrote:
> On Fri, 2017-05-05 at 16:55 -0700, Gary Gregory wrote:
> > In our method
> > _org.apache.http.nio.protocol.HttpAsyncService.exception(NHttpServerC
> > onnection,
> > Exception)_ the log() method does not always get called:
> >
> > @Override
> > public void exception(
> > final NHttpServerConnection conn, final Exception cause)
> > {
> > final State state = getState(conn);
> > if (state == null) {
> > shutdownConnection(conn);
> > log(cause);
> > return;
> > }
> > state.setTerminated();
> > closeHandlers(state, cause);
> > final Cancellable cancellable = state.getCancellable();
> > if (cancellable != null) {
> > cancellable.cancel();
> > }
> > final Queue<PipelineEntry> pipeline = state.getPipeline();
> > if (!pipeline.isEmpty()
> > || conn.isResponseSubmitted()
> > ||
> > state.getResponseState().compareTo(MessageState.INIT) >
> > 0) {
> > // There is not much that we can do if a response
> > // has already been submitted or pipelining is being
> > used.
> > shutdownConnection(conn);
> > } else {
> > try {
> > final Incoming incoming = state.getIncoming();
> > final HttpRequest request = incoming != null ?
> > incoming.getRequest() : null;
> > final HttpContext context = incoming != null ?
> > incoming.getContext() : new BasicHttpContext();
> > final HttpAsyncResponseProducer responseProducer =
> > handleException(cause, context);
> > final HttpResponse response =
> > responseProducer.generateResponse();
> > final Outgoing outgoing = new Outgoing(request,
> > response,
> > responseProducer, context);
> > state.setResponseState(MessageState.INIT);
> > state.setOutgoing(outgoing);
> > commitFinalResponse(conn, state);
> > /////////////////////////////////////////////////////
> > /////
> > /////////////////////////////////////////////////////
> > /////
> > // log() has not been called by the time we get here
> > /////////////////////////////////////////////////////
> > /////
> > /////////////////////////////////////////////////////
> > /////
> > } catch (final Exception ex) {
> > shutdownConnection(conn);
> > closeHandlers(state);
> > if (ex instanceof RuntimeException) {
> > throw (RuntimeException) ex;
> > } else {
> > log(ex);
> > }
> > }
> > }
> > }
> >
> > So I propose we move the call to log from:
> >
> > if (state == null) {
> > shutdownConnection(conn);
> > log(cause);
> > return;
> > }
> >
> > To the first line of the method:
> >
> > @Override
> > public void exception(
> > final NHttpServerConnection conn, final Exception cause)
> > {
> > log(cause);
> > final State state = getState(conn);
> > if (state == null) {
> > shutdownConnection(conn);
> > return;
> > }
> >
> > Thoughts?
> >
> > Gary
> >
>
> Gary
>
> It would make things much easier if you forked HttpCore at GitHub,
> patched your private fork, gave us a reference to the diff set in your
> repository and asked for a review.
>
> This should be the standard work-flow anyway once we migrate to Git.
>
> Oleg
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>
--
E-Mail: [email protected] | [email protected]
Java Persistence with Hibernate, Second Edition
<https://www.amazon.com/gp/product/1617290459/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1617290459&linkCode=as2&tag=garygregory-20&linkId=cadb800f39946ec62ea2b1af9fe6a2b8>
<http:////ir-na.amazon-adsystem.com/e/ir?t=garygregory-20&l=am2&o=1&a=1617290459>
JUnit in Action, Second Edition
<https://www.amazon.com/gp/product/1935182021/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1935182021&linkCode=as2&tag=garygregory-20&linkId=31ecd1f6b6d1eaf8886ac902a24de418%22>
<http:////ir-na.amazon-adsystem.com/e/ir?t=garygregory-20&l=am2&o=1&a=1935182021>
Spring Batch in Action
<https://www.amazon.com/gp/product/1935182951/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1935182951&linkCode=%7B%7BlinkCode%7D%7D&tag=garygregory-20&linkId=%7B%7Blink_id%7D%7D%22%3ESpring+Batch+in+Action>
<http:////ir-na.amazon-adsystem.com/e/ir?t=garygregory-20&l=am2&o=1&a=1935182951>
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory