At 09:56 PM 10/26/2001 +1000, you wrote: > > Maybe I'm missing something here, I can't see how to read data from a > > ThreadContext. > >you can't because that would break the pattern. Users can set the >ThreadContext if they have the correct permission but it is completely and >utterly up to the Policy to determine what happens. The users can never >directly interfer with that part of process.
i think i'm starting to follow it a bit more... ThreadContext is just an assistant to push values from that Map thru the ThreadContextPolicy. It is up to the policy to do something/anything with those values. correct? Thus the code in the DefaultThreadContextPolicy that takes the ClassLoader from the Context and assigns it as the thread's classloader. >The only reason ThreadContext.getThreadContext() exists is because sometimes >you may want to cache current context, apply another context, call another >method. After the method finishes you can set your old thread context back in >place. okie. I'm trying to assign a username/session ID to a thread. My RMI server answers, establishes username/session, stores that local to the current thread, does its duty, and returns. Currently I have a component with ThreadLocal variables to store that information. The RMI component that establishes username/session tells that component which values to store for the current thread, and then other components can lookup the session component to query current user/sessionid/otherstuffinthefuture. I'm not quite sure how to handle that using the ThreadContext. (The javadocs for that class mention that userID/transaction id are candidates for storage in the ThreadContext). Should the ThreadContextPolicy itself be my component that stores username/session ID? Should I read the appropriate variables from the ThreadContextAccessor and store them in my own ThreadLocals, or should I keep a copy of the ThreadContextAccessor? Once I get it all down I'll be able to write a nice little tutorial for the ThreadContext's :) -pete -- peter royal -> [EMAIL PROTECTED] managing partners, inc. -> http://www.managingpartners.com --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
