[hibernate-dev] [HV] ThreadLocal in ValidatorImpl

Sanne Grinovero sanne at hibernate.org
Tue Jan 10 13:49:00 EST 2012


Hi Hardy,
could you not use a single object parameter to which you add all
fields you need? ThreadLocals are never a good idea imho, I'd use it
only if you have no other choice (like can't break some API). It took
some time to remove them from Infinispan, much better now.
Is it just these two elements? I wouldn't bother too much in that case.

Cheers,
Sanne

On 10 January 2012 18:19, Hardy Ferentschik <hardy at hibernate.org> wrote:
> Hi,
>
> I was thinking about https://hibernate.onjira.com/browse/HV-439 which basically also means a
> refactoring of the current ValidatorImpl.
>
> One thing I noticed is that we start at one of the public Bean Validation methods and then
> create different context (e.g. ValueContext, ValidationConext) which we can passing around
> all the time, creating quite long method parameter lists.
>
> Would it be a good idea to introduce a ThreadLocal here and pass the context information this way?
> It would definitely clean up the methods signatures. Thoughts?
>
> --Hardy
> _______________________________________________
> hibernate-dev mailing list
> hibernate-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/hibernate-dev



More information about the hibernate-dev mailing list