You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Bryan Pon (JIRA)" <ji...@apache.org> on 2010/12/10 00:55:01 UTC

[jira] Created: (HTTPCORE-246) ThrottlingHttpClientHandler triggers EventListener.connectionClosed twice

ThrottlingHttpClientHandler triggers EventListener.connectionClosed twice
-------------------------------------------------------------------------

                 Key: HTTPCORE-246
                 URL: https://issues.apache.org/jira/browse/HTTPCORE-246
             Project: HttpComponents HttpCore
          Issue Type: Bug
    Affects Versions: 4.1
         Environment: Linux 2.6.32-26-generic #47-Ubuntu
            Reporter: Bryan Pon
            Priority: Minor


In ThrottlingHttpClientHandler.closed(NHttpClientConnection), connectionClosed() is called twice on the event listener:

        if (this.eventListener != null) {
            this.eventListener.connectionClosed(conn);
        }

        this.execHandler.finalizeContext(context);

        if (this.eventListener != null) {
            this.eventListener.connectionClosed(conn);
        }

I'm not sure if this is intentional (looks unlikely), but I have a use case where this causes problems.  I want to start a new connection whenever one is closed, so in the EventListener.connectionClosed() method I am invoking ConnectingIOReactor.connect().  Since connectionClosed() is triggered twice, this is opening two new connections.  I can work around the issue by checking if connectionClosed() has already been called.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] Resolved: (HTTPCORE-246) ThrottlingHttpClientHandler triggers EventListener.connectionClosed twice

Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HTTPCORE-246?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Oleg Kalnichevski resolved HTTPCORE-246.
----------------------------------------

       Resolution: Fixed
    Fix Version/s: 4.1.1

Bryan,

I fixed the bug in SVN trunk. Please review.

Actually EventListener was never intended for anything other than injecting basic HTTP connection lifecycle logging as HttpCore does not use any logging toolkit internally. One ought to have all protocol specific logic in the HttpRequestExecutionHandler implementation. HttpRequestExecutionHandler#finalizeContext is a better place for handling on connection close events than EventListener.

Oleg

> ThrottlingHttpClientHandler triggers EventListener.connectionClosed twice
> -------------------------------------------------------------------------
>
>                 Key: HTTPCORE-246
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-246
>             Project: HttpComponents HttpCore
>          Issue Type: Bug
>          Components: HttpCore NIO
>    Affects Versions: 4.1
>         Environment: Linux 2.6.32-26-generic #47-Ubuntu
>            Reporter: Bryan Pon
>            Priority: Minor
>             Fix For: 4.1.1
>
>
> In ThrottlingHttpClientHandler.closed(NHttpClientConnection), connectionClosed() is called twice on the event listener:
>         if (this.eventListener != null) {
>             this.eventListener.connectionClosed(conn);
>         }
>         this.execHandler.finalizeContext(context);
>         if (this.eventListener != null) {
>             this.eventListener.connectionClosed(conn);
>         }
> I'm not sure if this is intentional (looks unlikely), but I have a use case where this causes problems.  I want to start a new connection whenever one is closed, so in the EventListener.connectionClosed() method I am invoking ConnectingIOReactor.connect().  Since connectionClosed() is triggered twice, this is opening two new connections.  I can work around the issue by checking if connectionClosed() has already been called.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] Closed: (HTTPCORE-246) ThrottlingHttpClientHandler triggers EventListener.connectionClosed twice

Posted by "Bryan Pon (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HTTPCORE-246?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bryan Pon closed HTTPCORE-246.
------------------------------


Looks good to me.  And thanks for the tip - I'll change my logic to utilize finalizeContext instead.

> ThrottlingHttpClientHandler triggers EventListener.connectionClosed twice
> -------------------------------------------------------------------------
>
>                 Key: HTTPCORE-246
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-246
>             Project: HttpComponents HttpCore
>          Issue Type: Bug
>          Components: HttpCore NIO
>    Affects Versions: 4.1
>         Environment: Linux 2.6.32-26-generic #47-Ubuntu
>            Reporter: Bryan Pon
>            Priority: Minor
>             Fix For: 4.1.1
>
>
> In ThrottlingHttpClientHandler.closed(NHttpClientConnection), connectionClosed() is called twice on the event listener:
>         if (this.eventListener != null) {
>             this.eventListener.connectionClosed(conn);
>         }
>         this.execHandler.finalizeContext(context);
>         if (this.eventListener != null) {
>             this.eventListener.connectionClosed(conn);
>         }
> I'm not sure if this is intentional (looks unlikely), but I have a use case where this causes problems.  I want to start a new connection whenever one is closed, so in the EventListener.connectionClosed() method I am invoking ConnectingIOReactor.connect().  Since connectionClosed() is triggered twice, this is opening two new connections.  I can work around the issue by checking if connectionClosed() has already been called.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] Updated: (HTTPCORE-246) ThrottlingHttpClientHandler triggers EventListener.connectionClosed twice

Posted by "Bryan Pon (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HTTPCORE-246?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bryan Pon updated HTTPCORE-246:
-------------------------------

    Component/s: HttpCore NIO

> ThrottlingHttpClientHandler triggers EventListener.connectionClosed twice
> -------------------------------------------------------------------------
>
>                 Key: HTTPCORE-246
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-246
>             Project: HttpComponents HttpCore
>          Issue Type: Bug
>          Components: HttpCore NIO
>    Affects Versions: 4.1
>         Environment: Linux 2.6.32-26-generic #47-Ubuntu
>            Reporter: Bryan Pon
>            Priority: Minor
>
> In ThrottlingHttpClientHandler.closed(NHttpClientConnection), connectionClosed() is called twice on the event listener:
>         if (this.eventListener != null) {
>             this.eventListener.connectionClosed(conn);
>         }
>         this.execHandler.finalizeContext(context);
>         if (this.eventListener != null) {
>             this.eventListener.connectionClosed(conn);
>         }
> I'm not sure if this is intentional (looks unlikely), but I have a use case where this causes problems.  I want to start a new connection whenever one is closed, so in the EventListener.connectionClosed() method I am invoking ConnectingIOReactor.connect().  Since connectionClosed() is triggered twice, this is opening two new connections.  I can work around the issue by checking if connectionClosed() has already been called.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org