Community

Obtaining the Container in an Interceptor

reply from Carlo de Wolf in EJB 3.0 Development - View the full discussion

What exactly do you need from the container?

 

The code you quote must never be used from an interceptor it's either:

AbstractContainer.getContainer(invocation.getAdvisor());

or

EJBContainer.getContainer(invocation.getAdvisor());

depending on which container you want to talk (the low-level one or the real one).

 

Alternatively and I think the better approach, because we should be moving away from AOP and onto the real interceptor API.

InvocationContext context = CurrentInvocationContext.get();
AsyncBeanManager manager = (AsyncBeanManager) context.getBeanManager();

(needs work because of the cast.)

boolean doAsync = manager.isAsync(context.getMethod());

Reply to this message by going to Community

Start a new discussion in EJB 3.0 Development at Community