Generally well built frameworks like Spring will add what they need to the 
ThreadLocal upon entrance of a method and then remove them before exiting the 
method.  This works very well as long as the thread is only servicing one 
session.  Since DB interaction, etc could possibly block these operations 
should be done within a worker thread obtained from the thread pool.  As long 
as you have the Spring bits that access the thread local after you get a worker 
thread everything should work fine.

Rob

----- Original Message ----
From: hstang <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Sent: Saturday, April 14, 2007 9:44:37 AM
Subject: MINA and ThreadLocals used in other frameworks


Hi,

I was wondering if anyone has experiences successfully integrating MINA with
other frameworks that depend on ThreadLocals (e.g. Hibernate, Spring
transactions)?  

I looked through some bits and pieces of MINA code and it appears that
there's one thread that manages processing many different sessions, as it
should be.  The problem I see is that other frameworks often assume the
underlying architecture is a one-thread-per-request model and relies on
ThreadLocal for per-thread state, like transactions for example.  So suppose
if you were to use Hibernate during processing in MINA, is it possible MINA
sessions can pick up each other transaction context accidentally?  Do we
have to trust that other frameworks will cleanup the ThreadLocal variables
when it's done with the request?

-- 
View this message in context: 
http://www.nabble.com/MINA-and-ThreadLocals-used-in-other-frameworks-tf3576237.html#a9993272
Sent from the mina dev mailing list archive at Nabble.com.





__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Reply via email to