|
From: Rob H. <ro...@ca...> - 2004-06-21 22:10:10
|
Are you calling getBean() on different threads each time?
I have this test:
public void testMultipleProxies() {
ProxyFactory pf = new ProxyFactory(new Class[] { ITestBean.class });
pf.setProxyTargetClass(true);
MethodInterceptor static1 = new Advices.NopInterceptor();
MethodInterceptor static2 = new Advices.ReadDataInterceptor();
pf.addInterceptor(static1);
pf.addInterceptor(static2);
Advisor static3 = new Advices.SetterPointCut(new
Advices.NopInterceptor());
Advisor static4 = new Advices.SetterPointCut(new
Advices.ReadDataInterceptor());
pf.addAdvisor(static3);
pf.addAdvisor(static4);
pf.addAdvisor(new Advices.ObjectReturnPointCut(new
Advices.NopInterceptor()));
TestBean target = new TestBean();
pf.setTarget(target);
pf.setFrozen(true);
pf.setExposeProxy(false);
ITestBean proxy1 = (ITestBean) pf.getProxy();
ITestBean proxy2 = (ITestBean) pf.getProxy();
System.out.println(proxy1.getClass().getName());
System.out.println(proxy2.getClass().getName());
assertTrue(proxy1.getClass() == proxy2.getClass());
}
And it passes fine, however I have observed in the StaticAopTest class
in the load package that a different class is used for each thread in
the test suite runner. These classes have the same name with a _XX
suffix. This is not the same as before however when the class names
generated were completely different. I need to do a little more
investigation to see how Cglib implements the bytecode under all of
this.
Rob
On 21 Jun 2004, at 22:31, Norris, Tyson wrote:
> Rob et al -
> I've been trying out the changes in the Cglib2AopProxy class, and am
> still getting behavior where each instantiation of my proxied bean is
> iterating all the methods of the bean - as mentioned in jira issue
> SPR-175 (sorry for spreading this onto the mailing list - I thought
> others might have an opinion).
>
> I am concerned that my class is not properly getting cached by cglib.
>
> I have tried using the CVS version of Cglib2AopProxy (with the CVS
> version of cglib jar), and the classes returned by 2 consecutive calls
> to ApplicationContext.getBean(beanName) returns instances of the
> following classes:
>
> [my_class_name]$$EnhancerByCGLIB$$5ffa4f23_34@3452
>
> [my_class_name]$$EnhancerByCGLIB$$5ffa4f23_35@3455
>
> So I think the classes are not properly getting cached properly by
> CGLIB, although cglib's Key.hascode() is returning the same value in
> both cases (5ffa4f23).
>
> Anyhow, sorry if this is confusing, but I think there is a problem in
> there, but I haven't been able to get to the bottom of it.
>
> Thanks for any info or comments.
>
> Tyson
>
> -----Original Message-----
> From: Rob Harrop [mailto:ro...@ca...]
> Sent: Friday, June 11, 2004 2:46 PM
> To: spr...@li...
> Subject: Re: [Springframework-developer] Not leveraging the CGLIB cache
>
> James (All),
>
> First I better introduce myself, my name is Rob Harrop and I have been
> working on the Cglib proxy class, fixing bugs and improving
> performance.
>
> The problem you mention is now fixed, but it does rely on the HEAD of
> Cglib (which I mistakenly checked into CVS without changing the name).
> The new CallbackFilter correctly implements hashCode so that Cglib can
> cache class instances.
>
> Rob
>
> On 11 Jun 2004, at 22:05, James Cook wrote:
>
>> Rod,
>>
>> Do you remember this issue? Has this one been addressed yet?
>>
>> http://article.gmane.org/gmane.comp.java.springframework.user/1502
>>
>> From: Chris Nokleberg <chris <at> sixlegs.com>
>> Subject: Re: CGLIB proxies are not assignable
>> Newsgroups: gmane.comp.java.springframework.user
>> Date: Sun, 11 Apr 2004 17:15:30 +0000
>>
>> Rod Johnson <rod.johnson <at> interface21.com> writes:
>>> This is the behaviour I would expect. As you say, maybe we should
>>> add it to the docs. All proxies _are_ instances of the class to be
>>> proxied.
>>
>> I actually think this is a bug. If the name of the class is changing
>> it means that caching of generated classes is not working correctly
>> --it is probably generating a new class per proxy. This will obviously
>> slow down proxy creation tremendously and eventually cause
>> OutOfMemoryExceptions. The typical culprit is when you use a
>> custom CallbackFilter that does not implement equals/hashCode. I
>> don't have time right now but I'll take a look soon.
>>
>> Happy Easter
>> Chris
>>
>>
>>
>>
>>
>>
>> -------------------------------------------------------
>> This SF.Net email is sponsored by the new InstallShield X.
>> From Windows to Linux, servers to mobile, InstallShield X is the
>> one installation-authoring solution that does it all. Learn more and
>> evaluate today! http://www.installshield.com/Dev2Dev/0504
>> _______________________________________________
>> Springframework-developer mailing list
>> Spr...@li...
>> https://lists.sourceforge.net/lists/listinfo/springframework-developer
>>
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by the new InstallShield X.
> From Windows to Linux, servers to mobile, InstallShield X is the
> one installation-authoring solution that does it all. Learn more and
> evaluate today! http://www.installshield.com/Dev2Dev/0504
> _______________________________________________
> Springframework-developer mailing list
> Spr...@li...
> https://lists.sourceforge.net/lists/listinfo/springframework-developer
>
>
>
> -------------------------------------------------------
> This SF.Net email sponsored by Black Hat Briefings & Training.
> Attend Black Hat Briefings & Training, Las Vegas July 24-29 -
> digital self defense, top technical experts, no vendor pitches,
> unmatched networking opportunities. Visit www.blackhat.com
> _______________________________________________
> Springframework-developer mailing list
> Spr...@li...
> https://lists.sourceforge.net/lists/listinfo/springframework-developer
>
|