|
From: <kab...@jb...> - 2006-06-30 11:58:40
|
I think the simplest approach is to have an interceptor at the start of the chain, which manages this.
| public class ReentrancyStopperInterceptor implements Interceptor
| {
| ThreadLocal done = new ThreadLocal();
|
| private Object invoke(Invocation invocation) throws Throwable
| {
| boolean wasDone = ((Boolean)done.get()).booleanValue();
|
| try
| {
| if (!wasDone)
| {
| done.set(Boolean.TRUE);
| return invocation.invokeNext();
| }
| else
| {
| //Needs adding, and will invoke target joinpoint skipping the rest of the chain
| return invocation.dispatch();
| }
| }
| finally
| {
| if (!wasDone)
| {
| done.set(Boolean.FALSE);
| }
| }
|
| return ret;
| }
| }
|
I could implement the new dispatch() method pretty quickly, and I think this interceptor should belong in the aop module.
Similar functionality _could_ be added to the woven bytecode, but I don't think it is a good idea to code use-case stuff in there.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3954648#3954648
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3954648
|