Uploaded image for project: 'HttpComponents HttpCore'
  1. HttpComponents HttpCore
  2. HTTPCORE-246

ThrottlingHttpClientHandler triggers EventListener.connectionClosed twice

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 4.1
    • 4.1.1
    • HttpCore NIO
    • None
    • Linux 2.6.32-26-generic #47-Ubuntu

    Description

      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.

      Attachments

        Activity

          People

            Unassigned Unassigned
            bpon Bryan Pon
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: