James Carman wrote:

Because the software has to be ultra-stable! (Production quality)

Why not use HM 1.1 now and let us know if you come across any bugs?  That's
what the beta is for.


I'm trying to make an interceptor the same way as HM's
LoggingInterceptorFactory, but I have some problems with the following code:

private void createInfrastructure(InterceptorStack stack, ClassFab
classFab){
      Class topClass = ClassFabUtils.getInstanceClass(stack.peek(),
stack.getServiceInterface());
      classFab.addField("_delegate", topClass);
classFab.addConstructor(new Class[]{ topClass }, null, "{_delegate =
$1;}");
}


the debugger tells me topClass is: Class ($PooledProxy_1040f7af339_32)
which is the pooled instance of my real underlying class.

The function fails at line two, with this message:

Unable to process content of element construct/service: Unable to lookup
$PooledProxy_1040f7af339_32: $PooledProxy_1040f7af339_32
(DefaultErrorHandler.java:37)

I guess that this is beacuse topClass is no real class - but a dynamic
one - but the same should be true for the LoggingInterceptor - so I
cannot understand why this is a problem for my class ??

I posted a mail earlier with the same problem - and Knut's response:

"

The problem is a class loader issue. You're creating your own
ClassFactory instance, which in turn uses its own Javassist ClassPool,
which can't find the PooledProxy class HiveMind created using its own
ClassPool. You'll have to use HiveMind's ClassFactory.

For this you should define a setFactory(ClassFactory) method on your
interceptor factory and then add a line like this to the <construct>
of your interceptor factory service:

<set-service property="factory" service-id="hivemind.ClassFactory"/>

"

fixed the problem.

But I've fallen into a new one - on some methods I get this:

"
Unable to create class $Interceptor_1041511b5ba_38: (class: $Interceptor_1041511b5ba_38, method: defaultIntValueOf signature: (Ljava/lang/String;Ljava/lang/Object;I)I) Expecting to find object/array on stack
"

which I posted on the same mail thread.



A good old reply-to-myself:

I din't check for the correct return types (it failed on returning primitives). Now I check signature.getResulttype() and change the bodybuilder accordingly. If javassist dini't have the bug the code could be the same for all return types - I'm looking forward to HM 1.1! :-)


--
David J. M. Karlsen - +47 90 68 22 43
http://www.davidkarlsen.com
http://mp3.davidkarlsen.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to