Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » JBoss User Help »

[jboss-user] [JBoss AOP] - 1.5.5 GA: Problem with
 InstanceAdvisor->appendInterceptorSta

scott.stark@jboss.org

2007-07-12


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
_______________________________________________
jboss-user mailing list
jboss-user@(protected)
https://lists.jboss.org/mailman/listinfo/jboss-user
©2008 junlu.com - Jax Systems, LLC, U.S.A.