org.objectweb.jonas_ejb.container
Class JMdbEndpointFactory

java.lang.Object
  extended byorg.objectweb.jonas_ejb.container.JFactory
      extended byorg.objectweb.jonas_ejb.container.JMdbEndpointFactory
All Implemented Interfaces:
BeanFactory, javax.resource.spi.endpoint.MessageEndpointFactory

public class JMdbEndpointFactory
extends JFactory
implements javax.resource.spi.endpoint.MessageEndpointFactory

This class is a factory for a Message Driven Bean Endpoints There is one such class per MDB class. Contains all information related to the bean

Author:
Eric Hardesty

Field Summary
protected  int instanceCount
           
protected  int maxCacheSize
           
protected  int minPoolSize
           
 
Fields inherited from class org.objectweb.jonas_ejb.container.JFactory
beanclass, cont, dd, ejb10Env, ejbname, JNDICtx, naming, tm, txbeanmanaged
 
Constructor Summary
JMdbEndpointFactory(MessageDrivenJMS2_1Desc dd, JContainer cont, javax.resource.spi.ActivationSpec _as)
          Constructor
 
Method Summary
 void checkTransaction(RequestCtx rctx)
          For Message Driven Beans, only 2 cases are possible.
 javax.resource.spi.endpoint.MessageEndpoint createEndpoint(javax.transaction.xa.XAResource xaResource)
           
 int getCacheSize()
           
 JHome getHome()
          returns the home if exist or null if not
 JLocalHome getLocalHome()
          returns the local home if exist or null if not
 int getMaxCacheSize()
           
 JMessageEndpoint getMessageEndpoint()
          Return an MessageEndpoint from the pool.
 int getMinPoolSize()
           
 int getPoolSize()
          Get the size of the instance pool for this bean
 int getTransactionAttribute()
           
 boolean isDeliveryTransacted(java.lang.reflect.Method method)
           
 void notifyTimeout(javax.ejb.Timer timer)
          Notify a timeout for this bean
 void reduceCache()
          Reduce number of instances in memory in the free list we reduce to the minPoolSize
 void releaseEndpoint(JMessageEndpoint ep)
          put the JMessageEndpoint back to the pool
 void stop()
          stop this EJB.
 void sync()
          synchronize bean instances if needed
 
Methods inherited from class org.objectweb.jonas_ejb.container.JFactory
checkJonasVersion, checkTransactionContainer, getContainer, getDeploymentDescriptor, getEjb10Environment, getEJBName, getEnv, getInitialContext, getTimerService, getTransactionManager, init, isClassAvailable, isTxBeanManaged, myClassLoader, postInvoke, postInvokeRemote, preInvoke, preInvokeRemote, resetComponentContext, setComponentContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

instanceCount

protected int instanceCount

minPoolSize

protected int minPoolSize

maxCacheSize

protected int maxCacheSize
Constructor Detail

JMdbEndpointFactory

public JMdbEndpointFactory(MessageDrivenJMS2_1Desc dd,
                           JContainer cont,
                           javax.resource.spi.ActivationSpec _as)
Constructor

Parameters:
dd - Message Driven Descriptor
cont - Container where this bean is defined
Method Detail

getPoolSize

public int getPoolSize()
Description copied from interface: BeanFactory
Get the size of the instance pool for this bean

Specified by:
getPoolSize in interface BeanFactory
Specified by:
getPoolSize in class JFactory
Returns:
the size of the EndpointPool

stop

public void stop()
stop this EJB. call deactivate on the Endpoint Stop the threads and remove the beans

Specified by:
stop in interface BeanFactory

sync

public void sync()
synchronize bean instances if needed

Specified by:
sync in interface BeanFactory

getHome

public JHome getHome()
Description copied from interface: BeanFactory
returns the home if exist or null if not

Specified by:
getHome in interface BeanFactory
Returns:
the home if exist

getLocalHome

public JLocalHome getLocalHome()
Description copied from interface: BeanFactory
returns the local home if exist or null if not

Specified by:
getLocalHome in interface BeanFactory
Returns:
the local home if exist

createEndpoint

public javax.resource.spi.endpoint.MessageEndpoint createEndpoint(javax.transaction.xa.XAResource xaResource)
                                                           throws javax.resource.spi.UnavailableException
Specified by:
createEndpoint in interface javax.resource.spi.endpoint.MessageEndpointFactory
Returns:
the MessageEndpoint to deliver messages to
Throws:
javax.resource.spi.UnavailableException

isDeliveryTransacted

public boolean isDeliveryTransacted(java.lang.reflect.Method method)
                             throws java.lang.NoSuchMethodException
Specified by:
isDeliveryTransacted in interface javax.resource.spi.endpoint.MessageEndpointFactory
Returns:
boolean whether the specified method is transacted
Throws:
java.lang.NoSuchMethodException

getMessageEndpoint

public JMessageEndpoint getMessageEndpoint()
                                    throws java.lang.Exception
Return an MessageEndpoint from the pool. If pool is empty, creates a new one.

Returns:
an MessageEndpoint from the pool.
Throws:
java.lang.Exception - - if an application server fails to return an MessageEndpoint out of its pool.

releaseEndpoint

public void releaseEndpoint(JMessageEndpoint ep)
put the JMessageEndpoint back to the pool

Parameters:
ep - the MessageEndpoint

getMinPoolSize

public int getMinPoolSize()
Returns:
min pool size for Jmx

getMaxCacheSize

public int getMaxCacheSize()
Returns:
max cache size for Jmx

getCacheSize

public int getCacheSize()
Returns:
current cache size ( = nb of instance created) for Jmx

getTransactionAttribute

public int getTransactionAttribute()
Returns:
the Transaction Attribute

checkTransaction

public void checkTransaction(RequestCtx rctx)
For Message Driven Beans, only 2 cases are possible.

Parameters:
rctx - The Request Context

reduceCache

public void reduceCache()
Reduce number of instances in memory in the free list we reduce to the minPoolSize

Specified by:
reduceCache in interface BeanFactory

notifyTimeout

public void notifyTimeout(javax.ejb.Timer timer)
Notify a timeout for this bean

Parameters:
timer - timer whose expiration caused this notification.