Your making things more complex than they need to be.

Spring uses proxy objects for transaction management.  The proxy object takes 
care of adding objects to the ThreadLocal when the proxy method is entered and 
removing them before the proxy method is exited.  If you have your thread pool 
before the proxy object and don't do anything strange to "release" the thread 
from within the nested code everything will work fine.

WorkerPool (allocates thread)
    |
    Spring proxy
        --> start txn add stuff to ThreadLocal
        --> call proxied method to do actual work
        --> close (commit/rollback) txn, remove stuff from ThreadLocal
    Exit spring proxy
    |
Return Thread to WorkerPool 


----- Original Message ----
From: Urmeli <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Sent: Sunday, April 15, 2007 8:01:03 AM
Subject: Re: MINA and ThreadLocals used in other frameworks


The problem is: how can the frameworks determine the logical end of the
thread (the point in time when the thread is returned to the pool). In our
project we use HiveMind as the IoC container. HiveMind has the feature to
mark the entry and exit of a processing thread and all thread-bound
components can register a cleanup listener that is notified when the thread
is marked as exited. Works very well for us. I don't know if Spring has
anything similar ...

Mike
-- 
View this message in context: 
http://www.nabble.com/MINA-and-ThreadLocals-used-in-other-frameworks-tf3576237.html#a10001649
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