CloseableHttpClient instance has to be closed after all post has been executed, same handling for PoolingHttpClientConnectionManager instance shutdown
This commit is contained in:
parent
11e3992ab4
commit
7980449ac0
|
@ -10,9 +10,7 @@ import java.util.concurrent.Future;
|
|||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.NameValuePair;
|
||||
import org.apache.http.client.HttpClient;
|
||||
import org.apache.http.client.entity.UrlEncodedFormEntity;
|
||||
import org.apache.http.client.methods.CloseableHttpResponse;
|
||||
import org.apache.http.client.methods.HttpPost;
|
||||
|
@ -125,7 +123,6 @@ public class PublishGraphDBJobNode extends AsyncJobNode {
|
|||
for(Future<Integer> res : resList){
|
||||
if(res.get() == 200) countOk++;
|
||||
}
|
||||
client.close();
|
||||
log.info(String.format("Got all responses. Ok responses: %s/%s", countOk, countAll));
|
||||
|
||||
env.setAttribute(WorkflowsConstants.MAIN_LOG_PREFIX + "countOk", countOk);
|
||||
|
@ -138,7 +135,6 @@ public class PublishGraphDBJobNode extends AsyncJobNode {
|
|||
}
|
||||
if(countAll == 0) {
|
||||
log.warn("0 resources to publish");
|
||||
cm.shutdown();
|
||||
}
|
||||
|
||||
if (countOk > 0) {
|
||||
|
@ -170,6 +166,7 @@ public class PublishGraphDBJobNode extends AsyncJobNode {
|
|||
}
|
||||
finally{
|
||||
if(responsePOST != null) responsePOST.close();
|
||||
client.close();
|
||||
cm.shutdown();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue