I would say that you probably should write the validator to be
thread-safe (just to be sure). But, that being said, from a quick look
at the validation framework (check classes like
DefaultValidationFactory, ValidationInterceptor, etc. inside of
xwork), it looks like xwork caches the "validator config" and asks the
validator factory for instances when they are needed. The validator
factory retrieves the instance from the Object Factory, which is
creating and injecting a new instance for each validation.

I say that you should still make them thread-safe because I would
imagine at some point, the framework might create instances and cache
/ reuse them since reflections-based instantiation can be slow.

-Wes

On Sat, Jul 17, 2010 at 6:25 PM, Marshall Gunter <marsh...@mate1inc.com> wrote:
> Writing my own.
>
> On 10-07-15 08:33 PM, Christopher Schultz wrote:
>>
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> Marshall,
>>
>> On 7/15/2010 9:27 AM, Marshall Gunter wrote:
>>
>>>
>>> Do Struts 2 field validators need to be thread safe?
>>>
>>
>> That depends on what you want to do with them. Are you writing your own,
>> or are you critiquing the existing validator implementations?
>>
>> - -chris
>> -----BEGIN PGP SIGNATURE-----
>> Version: GnuPG v1.4.10 (MingW32)
>> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>>
>> iEYEARECAAYFAkw/qMgACgkQ9CaO5/Lv0PCUrACgstaFyPiVsxZJ8iswTE4zmn0k
>> qKUAn2J769JmFnQuL6VDVS01dX1SIW8c
>> =FM2d
>> -----END PGP SIGNATURE-----
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>> For additional commands, e-mail: user-h...@struts.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>



-- 
Wes Wannemacher

Head Engineer, WanTii, Inc.
Need Training? Struts, Spring, Maven, Tomcat...
Ask me for a quote!

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to