Title: RE: How do I pass data from Handler to the service?

its a static field on the service.  so in the handler, you would say <ServiceClassName>.threadLocal.set(obj); since its accessible in a static manner.

-----Original Message-----
From: Konstantinos Margaritis [mailto:[EMAIL PROTECTED]]
Sent: Thursday, May 20, 2004 4:22 PM
To: [EMAIL PROTECTED]
Subject: Re: How do I pass data from Handler to the service?


On Thursday 20 May 2004 23:07, Callahan, Paul wrote:
> Like another member said--don't go that route--not thread safe...
>
> You can create a ThreadLocal field on your service class like this
> however:
>
> protected final static ThreadLocal threadLocal = new ThreadLocal();
>
> And then you will be able to call the threadLocal.set(<your
> object>); method in your handler.
>
> You can access the value with the get() method--just cast to
> whatever class type you put in there.

Hm, still, I don't know how to reference my service class from the
handler. I mean how does the handler 'know' where is the service
class? Is there a member variable Service or something like that?

Konstantinos

Reply via email to