2009/11/2 Niclas Hedhman <[email protected]>

> On Mon, Nov 2, 2009 at 12:07 PM, Niclas Hedhman <[email protected]>
> wrote:
>
> > Since you are currently in the air, I'll try to create a testcase to
> > verify my suspicion.
>
> Testcase verifies that it works as expected...
>
> So, how can it?
>
> Behind the scene, CGLib sets the callbacks to a threadlocal in the
> generated class instance. Upon newInstance of that class the
> threadlocal values are applied to the generated instance's methods.
> So, all good and dandy.
>
> There is a concern about this process in
> http://opensource.atlassian.com/projects/hibernate/browse/HHH-2481,
> and in our case the "leak" is equivalent to one
> ThisCompositeInterceptor instance+reference and one NoOp.INSTANCE
> reference per generated type per thread creating composites. Unlike
> HHH-2481 example, this is not a lot, but we should perhaps do what it
> suggests anyway; clear the callbacks after the instance has been
> created?
>

FWIW that's what we do in guice:

      Enhancer.registerCallbacks(enhanced, callbacks);
      try {
        // ...create the proxy instance...
      } finally {
        Enhancer.registerCallbacks(enhanced, null);
      }


> Cheers
> --
> Niclas Hedhman, Software Developer
> http://www.qi4j.org - New Energy for Java
>
> I  live here; http://tinyurl.com/2qq9er
> I  work here; http://tinyurl.com/2ymelc
> I relax here; http://tinyurl.com/2cgsug
>
> _______________________________________________
> qi4j-dev mailing list
> [email protected]
> http://lists.ops4j.org/mailman/listinfo/qi4j-dev
>



-- 
Cheers, Stuart
_______________________________________________
qi4j-dev mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/qi4j-dev

Reply via email to