On Tue, 21 Jan 2003, Adolfo Miguelez wrote:

> Date: Tue, 21 Jan 2003 10:26:49 +0000
> From: Adolfo Miguelez <[EMAIL PROTECTED]>
> Reply-To: Struts Users Mailing List <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> Subject: Re: (Un)expected behaviour in Action instance variables?
>
> Hi,
>
> fortunately, after more testing theory is right and it happends that should
> happen. You are right.
>
> It is my fault since I was testing the variable after previous asignment so
> the variable got the different values because I was asigning a new value in
> every execution, previously to the logging. The pointer is anyway unique,
> since the Action instance is the same.
>
> My next attemp will be to use ThreadLocal variables to try to made every
> value of the variable take different values for every execution (Thread).
> Not very polite perhaps, but I save to pass the request in every accesor
> invocation.
>

ThreadLocal is definitely not free from a performance perspective,
particularly on pre-1.4 JDKs.  I think you're also looking at a path that
is going to dramatically increase the difficulty of maintaining this code
later.

Far better is to pass in the variables you need as parameters.

> Apologises and thanks,
>
> Adolfo

Craig



--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to