Hi there,
I am using RestTemplate from spring-android-rest-template 1.0.0.M4, which I construct on demand using
orCode:new RestTemplate();
Unfortunately, both constructors are leaking threads whose lifetime exceeds that of the respective RestTemplate instance as HttpAccessor has a private field that initializes a new HttpComponentsClientHttpRequestFactory anyway:Code:new RestTemplate(new SimpleClientHttpRequestFactory());
The spawned threads (one per RestTemplate instance) look like this:Code:private ClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory();
The threads are cleaned up in a finalizer, but given a sufficient amount of RestTemplate creations, the application will still crash due to a depletion of resources.Code:Daemon Thread [<17> RefQueueWorker@org.apache.http.impl.conn.tsccm.ConnPoolByRoute@44eb3ce8] (Running)
Any idea?
Thanks,
Thilo


Reply With Quote