org.objectweb.jonas_ejb.container
Class JMdbFactory

java.lang.Object
  |
  +--org.objectweb.jonas_ejb.container.JFactory
        |
        +--org.objectweb.jonas_ejb.container.JMdbFactory
All Implemented Interfaces:
BeanFactory, javax.jms.ServerSessionPool

public class JMdbFactory
extends JFactory
implements javax.jms.ServerSessionPool

This class is a factory for a Message Driven Bean There is one such class per MDB class. Contains all information related to the bean and set up all JMS environment for the bean It manages a ServerSession pool to server MDB requests.

Author:
Philippe Coq, Philippe Durieux

Field Summary
protected  javax.jms.XAQueueConnection qconn
          JMS Queue Connection (Topic or Queue) always use XA Connections for transactions.
protected  javax.jms.XATopicConnection tconn
          JMS Topic Connection always use XA Connections for transactions.
protected  ThreadPool threadpool
          Threadpool used to run ServerSessions
 
Fields inherited from class org.objectweb.jonas_ejb.container.JFactory
beanclass, cont, dd, ejb10Env, ejbname, JNDICtx, naming, tm, txbeanmanaged
 
Constructor Summary
JMdbFactory(MessageDrivenDesc dd, JContainer cont, ThreadPool thp)
          Constructor
 
Method Summary
 void checkTransaction(RequestCtx rctx)
          For Message Driven Beans, only 2 cases are possible.
 JHome getHome()
          returns the home if exist or null if not
 JLocalHome getLocalHome()
          returns the local home if exist or null if not
 int getPoolSize()
          Get the size of the instance pool for this bean
 javax.jms.ServerSession getServerSession()
          Return a server session from the pool.
 int getTransactionAttribute()
           
 void reduceCache()
          Reduce number of instances in memory
 void releaseServerSession(javax.jms.ServerSession ss)
          put the ServerSession back to the pool
 void stop()
          stop this EJB. call ejbRemove on all MDB close the connection consumer Stop the threads and remove the beans
 void sync()
          synchronize bean instances if needed
 
Methods inherited from class org.objectweb.jonas_ejb.container.JFactory
checkJonasVersion, checkTransactionContainer, getContainer, getCorbaInitialContext, getDeploymentDescriptor, getEjb10Environment, getEJBName, getEnv, getInitialContext, 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

threadpool

protected ThreadPool threadpool
Threadpool used to run ServerSessions

tconn

protected javax.jms.XATopicConnection tconn
JMS Topic Connection always use XA Connections for transactions.

qconn

protected javax.jms.XAQueueConnection qconn
JMS Queue Connection (Topic or Queue) always use XA Connections for transactions.
Constructor Detail

JMdbFactory

public JMdbFactory(MessageDrivenDesc dd,
                   JContainer cont,
                   ThreadPool thp)
Constructor
Parameters:
dd - Message Driven Descriptor
cont - Container where this bean is defined
thp - Thread pool that will be used to process MDB requests
Method Detail

getPoolSize

public int getPoolSize()
Description copied from interface: BeanFactory
Get the size of the instance pool for this bean
Overrides:
getPoolSize in class JFactory
Returns:
the size of the ServerSessionPool

stop

public void stop()
stop this EJB. call ejbRemove on all MDB close the connection consumer Stop the threads and remove the beans

sync

public void sync()
synchronize bean instances if needed

reduceCache

public void reduceCache()
Reduce number of instances in memory

getHome

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

getLocalHome

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

getServerSession

public javax.jms.ServerSession getServerSession()
                                         throws javax.jms.JMSException
Return a server session from the pool. If pool is empty, creates a new one.
Specified by:
getServerSession in interface javax.jms.ServerSessionPool
Returns:
a server session from the pool.
Throws:
javax.jms.JMSException - - if an application server fails to return a Server Session out of its server session pool.

releaseServerSession

public void releaseServerSession(javax.jms.ServerSession ss)
put the ServerSession back to the pool
Parameters:
ss - The ServerSession

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