Solr
  1. Solr
  2. SOLR-5825

Separate http request creation and execution in SolrJ

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: clients - java
    • Labels:
      None

      Description

      In order to implement some custom behaviors I split the request() method in HttpSolrServer into 2 distinct method createMethod() and executeMethod(). This allows for customization of either/both of these phases vs having it in a single function.

      In my use case I extended HttpSolrServer to support client side timeouts (so_timeout, connectTimeout and request timeout).. without duplicating the code in request() I couldn't accomplish..

      1. SOLR-5825.patch
        2 kB
        Erick Erickson
      2. SOLR-5825.patch
        1 kB
        Steven Bower

        Activity

        Hide
        Steven Bower added a comment -

        Here is the patch for this change

        Show
        Steven Bower added a comment - Here is the patch for this change
        Hide
        Steven Bower added a comment -

        Btw, this patch is fully backwards compatible as it leaves the existing request method signature alone and simply changes the internals to call 2 new functions.

        Show
        Steven Bower added a comment - Btw, this patch is fully backwards compatible as it leaves the existing request method signature alone and simply changes the internals to call 2 new functions.
        Hide
        Mark Miller added a comment -

        +1

        Show
        Mark Miller added a comment - +1
        Hide
        Erick Erickson added a comment -

        I took a brief look, my question is why pass the SolrRequest to executeMethod? It doesn't appear to be used. At least IntelliJ doesn't complain when I take it out. Running tests now with it removed..

        And I'm all for splitting that huge method up.....

        Show
        Erick Erickson added a comment - I took a brief look, my question is why pass the SolrRequest to executeMethod? It doesn't appear to be used. At least IntelliJ doesn't complain when I take it out. Running tests now with it removed.. And I'm all for splitting that huge method up.....
        Hide
        Erick Erickson added a comment -

        Patch with unused SorlRequest removed and an entry in CHANGES.txt

        Show
        Erick Erickson added a comment - Patch with unused SorlRequest removed and an entry in CHANGES.txt
        Hide
        ASF subversion and git services added a comment -

        Commit 1575576 from Erick Erickson in branch 'dev/trunk'
        [ https://svn.apache.org/r1575576 ]

        SOLR-5825, Separate http request creation and execution in SolrJ. Thanks Steve.

        Show
        ASF subversion and git services added a comment - Commit 1575576 from Erick Erickson in branch 'dev/trunk' [ https://svn.apache.org/r1575576 ] SOLR-5825 , Separate http request creation and execution in SolrJ. Thanks Steve.
        Hide
        ASF subversion and git services added a comment -

        Commit 1575722 from Erick Erickson in branch 'dev/branches/branch_4x'
        [ https://svn.apache.org/r1575722 ]

        SOLR-5825, Separate http request creation and execution in SolrJ. Thanks Steve.

        Show
        ASF subversion and git services added a comment - Commit 1575722 from Erick Erickson in branch 'dev/branches/branch_4x' [ https://svn.apache.org/r1575722 ] SOLR-5825 , Separate http request creation and execution in SolrJ. Thanks Steve.
        Hide
        Erick Erickson added a comment -

        Thanks Steve!

        Show
        Erick Erickson added a comment - Thanks Steve!

          People

          • Assignee:
            Erick Erickson
            Reporter:
            Steven Bower
          • Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development