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#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...