Tuesday, June 16, 2009

Abdera Client - Using teardown()

I was working on a program which makes several requests to Abdera back end from the client. The client was designed to use a new AbderaClient per request and teardown method was not used on AbderaClient instance after using.

This led to an exception when I run it concurrently (by using about 100 threads). AbderaClient uses HTTPClient and MultiThreadedHttpConnectionManager. Teardown method is the one who shuts down this connection manager and the best practice is to call teardown after using AbderaClient instance.
AbderaClient abderaClient = new AbderaClient(new Abdera());
// make the call
abderaClient.teardown();

Sharing a single instance of AbderaClient among all request is another option but some times it goes to a deadlock state (keeping a connection open for a long time is not recommended anyway).

2 comments:

Luis Jackson said...

So good to find somebody with some original thoughts on this subject. Thanks for starting this up.
Best essay writing service

asim jofa said...

Thanks for sharing your experience about your client that is helpful for my best essay service work. I wish you to keep sharing your experience here with us and i appreciate you way of talking because it is really easy and interesting.

Related Posts with Thumbnails