On Tue, Oct 19, 2010 at 9:51 AM, Jean-Baptiste BRIAUD -- Novlog <
j-b.bri...@novlog.com> wrote:

> I would add some (obvious ? if yes, sorry) things :
>
> Thanks for the tips, I think I've got these issues covered.


> 1. Ensure connection is at last closed or put back in the pool.
>

Yes, all threads have a "cleanup" routine that will rollback any open
transactions, free connection, close EM.


> 2. Test with and without a pool (or adjust value on pool) to force
> connection to be reused so you can test the code will have a long peaceful
> life on server.
>

Good point. My logs for the connection pool do show connection reuse
(resulting from unit test exercise).


> 3. heavy use of try {} finally{} block to ensure the flow control even in
> case of error in the other side.
>

Back to #1, cleanup routine has been in production a while, so pretty sure
it's solid.


> 4. Use of ThreadLocal may lead to memory leak, ensure connection is not
> only closed (1) but also remove from ThreadLocal at the end
>
>
I've taken some lumps with errors in my ThreadLocal implementation, but I
think the handling of clean up of both the JDBC connection and EM is solid.

-- 
Daryl Stultz
_____________________________________
6 Degrees Software and Consulting, Inc.
http://www.6degrees.com
http://www.opentempo.com
mailto:daryl.stu...@opentempo.com

Reply via email to