ctron / package-drone-jenkins

A Package Drone Plugin for Jenkins
3 stars 4 forks source link

The httpclient in never closed if executed on a Jenkins node #16

Closed nfalco79 closed 7 years ago

nfalco79 commented 7 years ago

I notice that the httpclient instantiated in the UploadFiles class is saved in a transient field (because is not serialisable) to be closed later in the build step.

The UploadFiles is a MasterToSlaveFileCallable and by design it could be executed on a slave node. The httpclient instantiated in the UploadFiles.invoke() method could not be closed because the httpclient instance is not serialised back to the master node.

To ensure the httpclient is closed correctly I moved the instantiation of the HTTP client inside the specific Uploader implementations, this has two advantages:

nfalco79 commented 7 years ago

@ctron need your code review