org.objectweb.jonas_ejb.container
Class JStatelessFactory

java.lang.Object
  extended by org.objectweb.jonas_ejb.container.JFactory
      extended by org.objectweb.jonas_ejb.container.JSessionFactory
          extended by org.objectweb.jonas_ejb.container.JStatelessFactory
All Implemented Interfaces:
BeanFactory

public class JStatelessFactory
extends JSessionFactory

This class is a factory for a Session Stateless Bean.

Author:
Philippe Durieux

Field Summary
protected  java.util.List bctxlist
          instance pool management (list of available JSessionContext objects) Contexts are pooled only for Stateless Session beans because for Stateful sessions a newInstance() is required by the spec.
protected  int instanceCount
           
protected  int maxCacheSize
           
protected  int minPoolSize
           
protected  JServiceEndpointHome sehome
           
 
Fields inherited from class org.objectweb.jonas_ejb.container.JSessionFactory
home, isStateful, isSynchro, localhome, sessionList, singleswitch, uniqueSession
 
Fields inherited from class org.objectweb.jonas_ejb.container.JFactory
beanclass, cont, dd, ejb10Env, ejbname, ejbTimeoutSignature, isClusterReplicated, JNDICtx, myTimerService, naming, passivationDir, stopped, timerTxAttr, tm, txbeanmanaged, wm
 
Constructor Summary
JStatelessFactory(SessionStatelessDesc dd, JContainer cont)
          constructor
 
Method Summary
 JSessionSwitch createNewSession()
          Creates a new Session Stateless
 int getCacheSize()
           
 JSessionContext getJContext(JSessionSwitch ss)
           
 int getMaxCacheSize()
           
 int getMinPoolSize()
           
 int getPoolSize()
          Get the size of the instance pool for this bean
 JServiceEndpointHome getSEHome()
           
 javax.ejb.TimerService getTimerService()
          Obtains the TimerService associated for this Bean
 void initInstancePool()
          Init pool of instances.
 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 releaseJContext(JContext ctx)
          Called after each method call
 void storeInstances(javax.transaction.Transaction tx)
          Store intances modified (used before finder ou select methods)
 
Methods inherited from class org.objectweb.jonas_ejb.container.JSessionFactory
checkTransaction, createEJB, getHome, getLocalHome, getTimeout, isSessionSynchro, isStateful, removeEJB, setTimeout, singleSwitchOn, stop, syncDirty
 
Methods inherited from class org.objectweb.jonas_ejb.container.JFactory
checkJonasVersion, checkSecurity, checkTransactionContainer, getContainer, getDeploymentDescriptor, getEjb10Environment, getEJBName, getEjbTimeoutSignature, getEnv, getInitialContext, getPassivationDir, getTimerTxAttribute, getTransactionManager, getWorkManager, init, 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
 

Field Detail

bctxlist

protected java.util.List bctxlist
instance pool management (list of available JSessionContext objects) Contexts are pooled only for Stateless Session beans because for Stateful sessions a newInstance() is required by the spec. We don't need synchronizedList here, because anyway, we synchronize already everywhere.


sehome

protected JServiceEndpointHome sehome

instanceCount

protected int instanceCount

minPoolSize

protected int minPoolSize

maxCacheSize

protected int maxCacheSize
Constructor Detail

JStatelessFactory

public JStatelessFactory(SessionStatelessDesc dd,
                         JContainer cont)
constructor

Parameters:
dd - Session Stateless Deployment Descriptor
cnt - Container where the bean is defined
Method Detail

initInstancePool

public void initInstancePool()
Init pool of instances.

Specified by:
initInstancePool in interface BeanFactory
Specified by:
initInstancePool in class JFactory

getSEHome

public JServiceEndpointHome getSEHome()

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 Instance pool size for this Ejb

reduceCache

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


getTimerService

public javax.ejb.TimerService getTimerService()
Obtains the TimerService associated for this Bean

Specified by:
getTimerService in class JFactory
Returns:
a JTimerService instance.

createNewSession

public JSessionSwitch createNewSession()
                                throws java.rmi.RemoteException
Creates a new Session Stateless

Specified by:
createNewSession in class JSessionFactory
Returns:
the new JSessionSwitch
Throws:
java.rmi.RemoteException

getJContext

public JSessionContext getJContext(JSessionSwitch ss)
Specified by:
getJContext in class JSessionFactory
Returns:
a SessionContext for Stateless Session Bean

releaseJContext

public void releaseJContext(JContext ctx)
Called after each method call

Parameters:
ctx - the Session Context

notifyTimeout

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

Parameters:
timer - timer whose expiration caused this notification.

getMinPoolSize

public int getMinPoolSize()
Overrides:
getMinPoolSize in class JFactory
Returns:
min pool size for Jmx

getMaxCacheSize

public int getMaxCacheSize()
Overrides:
getMaxCacheSize in class JFactory
Returns:
max cache size for Jmx

getCacheSize

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

storeInstances

public void storeInstances(javax.transaction.Transaction tx)
Description copied from interface: BeanFactory
Store intances modified (used before finder ou select methods)