[jboss-user] [JBoss AOP] - 1.5.5 GA: Problem with InstanceAdvisor->appendInterceptorSta
jay.guidos
do-not-reply at jboss.com
Thu Jul 12 01:39:04 EDT 2007
Hi All,
After successfully appending a single interceptor to an advised instance, I am now trying to append an interceptor stack to the same instance. The code looks like this:
| if (managedProcessorService instanceof Advised)
| {
| InstanceAdvisor advisor = ((Advised) managedProcessorService)._getInstanceAdvisor();
|
| // establish basic per-instance interceptor configuration
| advisor.appendInterceptorStack(userTransactions?"transacted-msp":"non-transacted-msp");
|
| // add optional per-instance interceptors
| if (processEventMonitorService != null)
| advisor.appendInterceptor(new ProcessEventInterceptor(processEventMonitorService.get()));
| }
|
The call to advisor.appendInterceptorStack() throws a class cast exception. Digging in the code, it turns out this call is handled by ClassInstanceAdvisor.appendInterceptorStack(). That method calls a private method:
|
| private Object getInstance()
| {
| if (instanceRef != null)
| {
| return (Advisor)instanceRef.get();
| }
| return null;
| }
|
|
The cast here is unnecessary, as the return value of the method is Object. In addition, looking at the code in the appendInterceptorStack method it seems that it is really expecting an Advised class, not an Advisor anyway.
Is this a bug?
Jay Guidos
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4063316#4063316
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4063316
More information about the jboss-user
mailing list