|
From: Rob H. <ro...@ca...> - 2004-06-22 20:33:40
|
Tyson (All),
Some more news on this. Did some extensive testing on the train today
and I am a bit stumped to be honest. The Cglib Key class that is
created for both proxies is the same and therefore should use same
class as the first instance, and indeed this works when the target is
unadvised. I have two theories which I have been unable to test so far
but hope to do so tomorrow/Thurs unless anyone else gets to it first.
First theory (the unlikely one), is that the SoftReferences used to
cache the proxy is being collected. Second, more likely theory, is that
the Key class some how fails to work correctly when there are a certain
number of callbacks. There are a LOT more callbacks created for advised
targets than non advised targets.
I will raise this issue with the guys at Cglib, we are already
discussing some other matters. But I think that we could also create
our own cache as long we get all of the relevant parameters (not just
superclass name) in the key for the cache. I will experiment with this
and see where I get.
Rob
On 22 Jun 2004, at 09:21, Rob Harrop wrote:
> Tyson,
>
> I have managed to narrow this down to occuring only on advised
> targets. I anticipate this is a problem with the hashcode
> implementation of one of the callbacks and I will hopefully have a fix
> by the end of the day.
>
> Rob
>
> On 22 Jun 2004, at 01:34, Norris, Tyson wrote:
>
>> public void testMultipleProxies() {
>> ProxyFactory pf = new ProxyFactory(new Class[] { ITestBean.class
>> });
>> pf.setProxyTargetClass(true);
>>
>> MethodInterceptor static1 = new 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();
>> TestBean target2 = new TestBean();
>>
>>
>> pf.setTarget(target);
>> pf.setFrozen(true);
>> pf.setExposeProxy(false);
>>
>> ProxyFactory pf2 = new ProxyFactory(new Class[] {
>> ITestBean.class });
>> pf2.copyFrom(pf);
>> pf2.setTarget(target2);
>>
>>
>> ITestBean proxy1 = (ITestBean) pf.getProxy();
>> ITestBean proxy2 = (ITestBean) pf2.getProxy();
>>
>> System.out.println(proxy1.getClass().getName());
>> System.out.println(proxy2.getClass().getName());
>>
>> assertTrue(proxy1.getClass() == proxy2.getClass());
>>
>> }
>
>
>
> -------------------------------------------------------
> 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
>
|