[jboss-user] [EJB3] - Internal invocation of EJB3 bean methods
Paul Robinson
do-not-reply at jboss.com
Wed Feb 15 12:23:14 EST 2012
Paul Robinson [https://community.jboss.org/people/paul.robinson] created the discussion
"Internal invocation of EJB3 bean methods"
To view the discussion, visit: https://community.jboss.org/message/716885#716885
--------------------------------------------------------------
Hello,
I have a scenario where I am using CDI to add an interceptor to an EJB method. The interceptor is as follows:
@ServiceRequest
@Interceptor
public class ServiceRequestInterceptor
{
@AroundInvoke
public Object intercept(InvocationContext ic) throws Throwable
{
Method serviceMethod = ic.getMethod();
Object serviceImpl = ic.getTarget();
ProtocolHandler protocolHandler = HandlerFactory.createInstance(serviceImpl, serviceMethod);
return protocolHandler.proceed(ic);
}
}
This registers the EJB implementation class and the intercepted method with my middleware. My middleware will then invoke methods on the EJB at various times. The problem I am having is that the EJB implementing instance is invoked directly, by my middleware, due to the way I am obtaining the reference. This doesn't seem like the right approach to me as it is bypassing the EJB3 interceptors. Also, the EJB may be re-allocated, pasivated, etc, which is going to result in odd behavior, I expect.
Should I somehow look up the local stub to the EJB, based on what information I can gather from the implementation class; or is there a better way?
Thanks,
Paul.
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/716885#716885]
Start a new discussion in EJB3 at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2029]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20120215/f5d7f096/attachment.html
More information about the jboss-user
mailing list