On Wed, 2016-11-09 at 13:43 -0700, Shawn Heisey wrote:
> I'm using SolrJ 6.2.1 in the program I'm writing, which pulls in
> httpclient/httpmime 4.5.2 and httpcore 4.4.5 as dependencies.
> 
> One of the things that my SolrJ code does takes over an hour to
> complete.  The HTTP connection is kept open for all that time.  I'd like
> to find a way for the Solr server to respond immediately and continue
> the operation in the background, but currently there doesn't seem to be
> a way to do that.
> 
> Now I am attempting to make it possible to gracefully shut down
> everything related to what my code does, turn everything into garbage,
> reload the configuration, and build it all back up.  Therefore I need to
> know how certain things behave at close/shutdown, assuming everything is
> not idle.
> 
> What happens to a long-lived HTTP connection if another thread calls
> close() on the HttpClient?  Does the connection immediately die and
> throw an exception, or would the connection finish as expected in its
> own time? 

Hi Shawn

Yes, it does. CloseableHttpClient#close immediately purges the internal
pool of all connections both active (leased) and inactive (kept alive).
HC 5.0 will support graceful shutdown option whereby one can give
connections some grace period to complete ongoing exchanges prior to
shutting down. 
  
Hope this helps

Oleg

>  If the connection remains open until completion, does the
> close() call return immediately, or wait until that connection ends,
> whether successful or not?  Are all object references (threads in
> particular) properly released and turned into garbage?  I tried to
> follow the code, but got lost quickly.  If it's documented somewhere,
> please point me at that documentation.
> 
> Thanks,
> Shawn
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org
> For additional commands, e-mail: httpclient-users-h...@hc.apache.org
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org
For additional commands, e-mail: httpclient-users-h...@hc.apache.org

Reply via email to