tags:

views:

336

answers:

1

Application Server: JBOss 4.2

I have a method which I want to intercept.Its a method annotated @Timeout and invoked by javax.ejb.TimerService instance.

The method signature:

@Stateless
class A 
        @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
    @Timeout
        @Interceptors(AnInterceptor.class)
    public void doSomething(Timer timer)...

Now I have the interceptor class:

public class AnInterceptor {
       @AroundInvoke
       public Object intercept(InvocationContext ic) throws Exception{...
     System.out.prin(...)

It does work on other method methods (which are not annotated with @Timeout)

Thanks, Rod

+1  A: 

Per the spec, AroundInvoke is not supported for timeout methods (business interface, component interface, and webservice endpoint only). Searching Google, AroundTimeout appears to be coming in EJB 3.1 (pages 12 and 22):

http://www.ow2.org/xwiki/bin/download/Events2009AnnualConference/Program/JavaEE6-EasyBeans-F-Benoit.pdf

In the meantime, you can workaround the issue by injecting a reference to the same bean into itself. In other words inject (or lookup) another "A" from within "A", and then create and invoke a new "doTimeout" method from your "doSomething" method.

bkail