HttpClient 釋放鏈接

Release the Connection:釋放鏈接

This is a crucial step to keep things flowing. We must tell HttpClient that we are done with the connection and that it can now be reused. Without doing this HttpClient will wait indefinitely for a connection to free up so that it can be reused.this

釋放鏈接是使系統持續運行的一個十分關鍵的步驟。咱們必須顯式地告訴HttpClient,咱們已經用完了一個鏈接而且這個鏈接已經能夠被收回+複用了。若是不作這個動做,HttpCllient會一直無限地等待鏈接被釋放,而後複用它。code

 

關鍵代碼:blog

method.releaseConnection();

請將上面的代碼放在finally代碼塊中ci

相關文章
相關標籤/搜索