org.objectweb.jonas_ejb.container
Class JSessionFactory

java.lang.Object
  extended byorg.objectweb.jonas_ejb.container.JFactory
      extended byorg.objectweb.jonas_ejb.container.JSessionFactory
All Implemented Interfaces:
BeanFactory
Direct Known Subclasses:
JStatefulFactory, JStatelessFactory

public abstract class JSessionFactory
extends JFactory

This class is a factory for a Session Bean. It is responsible for - managing Home and LocalHome. - keeping the JNDI context for this component (java:comp/env)

Author:
Philippe Durieux

Field Summary
protected  JSessionHome home
           
protected  boolean isStateful
           
protected  boolean isSynchro
           
protected  JSessionLocalHome localhome
           
protected  java.util.ArrayList sessionList
          Pool of free JSessionSwitch objects Used if singleswitch=false.
protected  boolean singleswitch
          If no timeout, we can manage only 1 JSessionSwitch for all sessions.
protected  JSessionSwitch uniqueSession
          Unique JSessionSwitch when singleswitch=true
 
Fields inherited from class org.objectweb.jonas_ejb.container.JFactory
beanclass, cont, dd, ejb10Env, ejbname, ejbTimeoutSignature, isClusterReplicated, JNDICtx, maxCacheSize, minPoolSize, myTimerService, naming, passivationDir, stopped, timerTxAttr, tm, txbeanmanaged, wm
 
Constructor Summary
JSessionFactory(SessionDesc dd, JContainer cont)
          constructor
 
Method Summary
 void checkTransaction(RequestCtx rctx)
          Session beans can be container managed or bean managed transaction Session home don't check transactional context.
 JSessionSwitch createEJB()
          Create a new Session Find one in the pool, or create a new object.
protected abstract  JSessionSwitch createNewSession()
           
 JHome getHome()
          returns the home if exist or null if not
abstract  JSessionContext getJContext(JSessionSwitch ss)
           
 JLocalHome getLocalHome()
          returns the local home if exist or null if not
 int getTimeout()
           
 boolean isSessionSynchro()
           
 boolean isStateful()
           
 void removeEJB(JSessionSwitch bs)
          remove a Session.
 void setTimeout(int t)
          set the current timeout value for Jmx
 boolean singleSwitchOn()
          Return true if singleswitch option is on.
 void stop()
          stop this EJB.
 void syncDirty(boolean notused)
          synchronize bean instances if needed
 
Methods inherited from class org.objectweb.jonas_ejb.container.JFactory
checkJonasVersion, checkSecurity, checkTransactionContainer, getCacheSize, getContainer, getDeploymentDescriptor, getEjb10Environment, getEJBName, getEjbTimeoutSignature, getEnv, getInitialContext, getMaxCacheSize, getMinPoolSize, getPassivationDir, getPoolSize, getTimerService, getTimerTxAttribute, getTransactionManager, getWorkManager, init, initInstancePool, isClassAvailable, isStopped, isTxBeanManaged, myClassLoader, postInvoke, postInvokeRemote, preInvoke, preInvokeRemote, resetComponentContext, restartTimers, setComponentContext, stopContainer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.objectweb.jonas_ejb.container.BeanFactory
reduceCache, storeInstances
 

Field Detail

home

protected JSessionHome home

localhome

protected JSessionLocalHome localhome

isSynchro

protected boolean isSynchro

isStateful

protected boolean isStateful

sessionList

protected java.util.ArrayList sessionList
Pool of free JSessionSwitch objects Used if singleswitch=false.


uniqueSession

protected JSessionSwitch uniqueSession
Unique JSessionSwitch when singleswitch=true


singleswitch

protected boolean singleswitch
If no timeout, we can manage only 1 JSessionSwitch for all sessions. Only used in case of stateless, for load balancing.

Constructor Detail

JSessionFactory

public JSessionFactory(SessionDesc dd,
                       JContainer cont)
constructor

Parameters:
dd - The Session Deployment Descriptor
cont - The Container where the bean is defined.
Method Detail

singleSwitchOn

public boolean singleSwitchOn()
Return true if singleswitch option is on.

Returns:

stop

public void stop()
stop this EJB. Mainly unregister it in JNDI.


syncDirty

public void syncDirty(boolean notused)
synchronize bean instances if needed

Parameters:
notused - True if store even if passivation timeout not elapsed

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

createEJB

public JSessionSwitch createEJB()
                         throws java.rmi.RemoteException
Create a new Session Find one in the pool, or create a new object.

Returns:
a SessionSwitch
Throws:
java.rmi.RemoteException

removeEJB

public void removeEJB(JSessionSwitch bs)
remove a Session. This may be called also on timeout. put it back in the pool for later use.

Parameters:
bs - The Bean Session Switch to put back in the pool.

checkTransaction

public void checkTransaction(RequestCtx rctx)
Session beans can be container managed or bean managed transaction Session home don't check transactional context.

Parameters:
rctx - The Request Context

isSessionSynchro

public boolean isSessionSynchro()
Returns:
True if this Session implements SessionSynchronization

getTimeout

public int getTimeout()
Returns:
the current timeout value in seconds for Jmx

setTimeout

public void setTimeout(int t)
set the current timeout value for Jmx


isStateful

public boolean isStateful()
Returns:
true if this Session is Stateful. Will be used internally by EJBObject or EJBLocalObject because they are common to both types.

getJContext

public abstract JSessionContext getJContext(JSessionSwitch ss)
Returns:
a JSessionContext

createNewSession

protected abstract JSessionSwitch createNewSession()
                                            throws java.rmi.RemoteException
Throws:
java.rmi.RemoteException