org.openejb.mdb
Class EndpointHandler

java.lang.Object
  extended byorg.openejb.mdb.EndpointHandler
All Implemented Interfaces:
net.sf.cglib.proxy.Callback, net.sf.cglib.proxy.MethodInterceptor

public class EndpointHandler
extends Object
implements net.sf.cglib.proxy.MethodInterceptor

Container for the local interface of a Message Driven Bean. This container owns implementations of EJBLocalHome and EJBLocalObject that can be used by a client in the same classloader as the server.

The implementation of the interfaces is generated using cglib FastClass proxies to avoid the overhead of native Java reflection.

The J2EE connector and EJB specifications are not clear on what happens when beforeDelivery or afterDelivery throw an exception, so here is what we have decided:

Exception from beforeDelivery: if container started TX, roll it back reset class loader to adapter classloader reset state to STATE_NONE

Exception from delivery method: if container started TX, roll it back reset class loader to adapter classloader if state was STATE_BEFORE_CALLED, set state to STATE_ERROR so after can still be called

Exception from afterDelivery: if container started TX, roll it back reset class loader to adapter classloader reset state to STATE_NONE

One subtle side effect of this is if the adapter ignores an exception from beforeDelivery and continues with delivery and afterDelivery, the delivery will be treated as a single standalone delivery and the afterDelivery will throw an IllegalStateException.

Version:
$Revision: 445802 $ $Date: 2005-11-08 21:36:46 +0100 (Tue, 08 Nov 2005) $

Constructor Summary
EndpointHandler(MDBContainer container, org.apache.geronimo.transaction.manager.NamedXAResource xaResource, int[] operationMap)
           
 
Method Summary
 void afterDelivery()
           
 void beforeDelivery(Method method)
           
 Object intercept(Object proxy, Method method, Object[] args, net.sf.cglib.proxy.MethodProxy methodProxy)
           
 void release()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EndpointHandler

public EndpointHandler(MDBContainer container,
                       org.apache.geronimo.transaction.manager.NamedXAResource xaResource,
                       int[] operationMap)
Method Detail

beforeDelivery

public void beforeDelivery(Method method)
                    throws NoSuchMethodException,
                           javax.resource.ResourceException
Throws:
NoSuchMethodException
javax.resource.ResourceException

intercept

public Object intercept(Object proxy,
                        Method method,
                        Object[] args,
                        net.sf.cglib.proxy.MethodProxy methodProxy)
                 throws Throwable
Specified by:
intercept in interface net.sf.cglib.proxy.MethodInterceptor
Throws:
Throwable

afterDelivery

public void afterDelivery()
                   throws javax.resource.ResourceException
Throws:
javax.resource.ResourceException

release

public void release()


Copyright © 1999-2006 OpenEJB. All Rights Reserved.