Package com.sun.ejb.containers
Class StatelessSessionContainer
- java.lang.Object
-
- com.sun.ejb.containers.BaseContainer
-
- com.sun.ejb.containers.StatelessSessionContainer
-
- All Implemented Interfaces:
Container,com.sun.enterprise.container.common.spi.JavaEEContainer,org.glassfish.enterprise.iiop.spi.EjbContainerFacade
public class StatelessSessionContainer extends BaseContainer
This class provides container functionality specific to stateless SessionBeans. At deployment time, one instance of the StatelessSessionContainer is created for each stateless SessionBean type (i.e. deployment descriptor) in a JAR.The 3 states of a Stateless EJB (an EJB can be in only 1 state at a time): 1. POOLED : ready for invocations, no transaction in progress 2. INVOKING : processing an invocation 3. DESTROYED : does not exist
This container services invocations using a pool of EJB instances. An instance is returned to the pool immediately after the invocation completes, so the # of instances needed = # of concurrent invocations.
A Stateless Bean can hold open DB connections across invocations. Its assumed that the Resource Manager can handle multiple incomplete transactions on the same connection.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classStatelessSessionContainer.SessionContextFactory-
Nested classes/interfaces inherited from class com.sun.ejb.containers.BaseContainer
BaseContainer.ContainerInfo, BaseContainer.ContainerType, BaseContainer.PreInvokeException
-
-
Field Summary
Fields Modifier and Type Field Description protected AbstractPoolpool-
Fields inherited from class com.sun.ejb.containers.BaseContainer
_logger, cacheProbeListener, cacheProbeNotifier, callFlowInfo, componentId, CONTAINER_INITIALIZING, CONTAINER_ON_HOLD, CONTAINER_STARTED, CONTAINER_STOPPED, CONTAINER_UNDEPLOYED, containerInfo, containerState, containerStateManager, containerTransactionManager, containerType, debugMonitorFlag, ejbActivateMethod, ejbClass, ejbContainerUtilImpl, ejbDescriptor, ejbGeneratedOptionalLocalBusinessIntfClass, ejbHome, ejbHomeImpl, ejbHomeStub, ejbIntfMethodInfo, ejbIntfMethods, ejbLocalBusinessHome, ejbLocalBusinessHomeImpl, ejbLocalHome, ejbLocalHomeImpl, EJBLocalObject_getPrimaryKey, EJBObject_getPrimaryKey, ejbOptionalLocalBusinessHome, ejbOptionalLocalBusinessHomeImpl, ejbOptionalLocalBusinessHomeIntf, ejbPassivateMethod, ejbProbeListener, ejbProbeNotifier, ejbRemoteBusinessHome, ejbRemoteBusinessHomeImpl, ejbRemoteBusinessHomeStub, ejbRemoveMethod, envProps, hasLocalBusinessView, hasLocalHomeView, hasOptionalLocalBusinessView, hasRemoteBusinessView, hasRemoteHomeView, homeIntf, injectionManager, interceptorManager, invocationInfoMap, invocationManager, isBeanManagedTran, isLocal, isMessageDriven, isRemote, isSession, isSingleton, isStatefulSession, isStatelessSession, isWebServiceEndpoint, loader, localBusinessHomeIntf, localBusinessIntfs, localHomeIntf, logParams, metadata, methodMonitorMap, monitorOn, namingManager, NO_PARAMS, optIntfClassLoader, poolProbeListener, remoteBusinessHomeIntf, remoteBusinessIntfInfo, remoteHomeRefFactory, remoteIntf, scheduleIds, securityManager, sfsbSerializedClass, SINGLETON_BEAN_POOL_PROP, timerProbeListener, timerProbeNotifier, transactionManager, webServiceEndpointIntf, webServiceInvocationInfoMap
-
Fields inherited from interface com.sun.ejb.Container
SEC_CHECKED, SEC_EXCLUDED, SEC_NOT_INITIALIZED, SEC_UNCHECKED, secAttrStrings, TX_BEAN_MANAGED, TX_MANDATORY, TX_NEVER, TX_NOT_INITIALIZED, TX_NOT_SUPPORTED, TX_REQUIRED, TX_REQUIRES_NEW, TX_SUPPORTS, txAttrStrings
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedStatelessSessionContainer(BaseContainer.ContainerType conType, EjbDescriptor desc, ClassLoader loader, com.sun.enterprise.security.SecurityManager sm)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected EJBContextImpl_constructEJBContextImpl(Object instance)protected ComponentContext_getContext(EjbInvocation inv)Called from preInvoke which is called from the EJBObject for local and remote invocations.voidactivateEJB(Object ctx, Object instanceKey)protected voidafterBegin(EJBContextImpl context)protected voidafterCompletion(EJBContextImpl ctx, int status)protected voidbeforeCompletion(EJBContextImpl context)protected voidcheckExists(EJBLocalRemoteObject ejbObj)Check if the given EJBObject/LocalObject has been removed.protected voidcreateBeanPool()EJBLocalObjectImplcreateEJBLocalBusinessObjectImpl(boolean localBeanView)Called during internal creation of session beanEJBLocalObjectImplcreateEJBLocalObjectImpl()Called during client creation request through EJB LocalHome view.EJBObjectImplcreateEJBObjectImpl()EJBObjectImplcreateRemoteBusinessObjectImpl()protected voiddoConcreteContainerShutdown(boolean appBeingUndeployed)TODO ??? public void appendStats(StringBuffer sbuf) { sbuf.append("\nStatelessContainer: ") .append("CreateCount=").append(statCreateCount).append("; ") .append("RemoveCount=").append(statRemoveCount).append("; ") .append("]"); }protected voiddoTimerInvocationInit(EjbInvocation inv, Object primaryKey)This is implemented by concrete containers that support TimedObjects.protected voidforceDestroyBean(EJBContextImpl sc)Force destroy the EJB.protected EJBLocalObjectImplgetEJBLocalObjectImpl(Object key)Called from EJBLocalObjectImpl.getLocalObject() while deserializing a local object reference.protected EJBObjectImplgetEJBObjectImpl(byte[] instanceKey)Called when a remote invocation arrives for an EJB.intgetMaxPoolSize()longgetMethodReadyCount()StringgetMonitorAttributeValues()protected EjbMonitoringStatsProvidergetMonitoringStatsProvider(String appName, String modName, String ejbName)intgetSteadyPoolSize()protected voidinitializeHome()Called from the ContainerFactory during initialization.protected booleanisIdentical(EJBObjectImpl ejbo, jakarta.ejb.EJBObject other)voidonReady()Called when server instance is ReadybooleanpassivateEJB(ComponentContext context)protected voidregisterMonitorableComponents()voidreleaseContext(EjbInvocation inv)Called from preInvoke which is called from the EJBObject for local and remote invocations.protected voidremoveBean(EJBLocalRemoteObject ejbo, Method removeMethod, boolean local)protected booleanresumeTransaction(EjbInvocation inv)booleanscanForEjbCreateMethod()protected booleansuspendTransaction(EjbInvocation inv)booleanuserTransactionMethodsAllowed(org.glassfish.api.invocation.ComponentInvocation inv)EJB spec makes a distinction between access to the UserTransaction object itself and access to its methods.-
Methods inherited from class com.sun.ejb.containers.BaseContainer
_constructEJBInstance, addInvocationInfo, addLocalRemoteInvocationInfo, addProxyInterfacesSetClass, adjustHomeTargetMethodInfo, adjustInvocationInfo, assertValidLocalObject, assertValidRemoteObject, authorize, authorizeLocalGetPrimaryKey, authorizeLocalMethod, authorizeRemoteGetPrimaryKey, authorizeRemoteMethod, callEJBTimeout, cancelTimers, checkExceptionClientTx, checkUnfinishedTx, checkUserTransactionLookup, cleanupInstance, containerStateToString, createCallFlowAgent, createEjbInstanceAndContext, createEjbInstanceForInterceptors, createEjbInvocation, createEjbInvocation, createMonitoringRegistry, createRemoteReferenceWithId, delistExtendedEntityManagers, doAfterBegin, doEJBHomeRemove, doFlush, enlistExtendedEntityManagers, externalPostInvoke, externalPreInvoke, findFlushEnabledAttr, getApplicationId, getClassLoader, getComponentId, getContainerClassLoader, getContainerId, getContainerType, getContext, getDebugMonitorFlag, getDescriptor, getEJBClass, getEjbDescriptor, getEJBHome, getEJBHomeInvocationHandler, getEJBHomeStub, getEJBLocalBusinessHome, getEJBLocalHome, getEJBLocalHomeInvocationHandler, getEJBLocalObjectForPrimaryKey, getEJBLocalObjectForPrimaryKey, getEJBMetaData, getEJBObjectForPrimaryKey, getInvocationKey, getJaccEjb, getJavaGlobalJndiNamePrefix, getMonitoringMethodsArray, getMonitoringMethodsArray, getPassByReference, getPre30LifecycleMethodNames, getProtocolManager, getSecurityManager, getTargetObject, getTimeoutMethod, getTxAttr, getTxAttr, getTxAttrForLifecycleCallback, getUserTransaction, getUseThreadPoolId, incrementCreatedTimedObject, incrementDeliveredTimedObject, incrementRemovedTimedObject, initializeProtocolManager, injectEjbInstance, instantiateEJBLocalBusinessObjectImpl, instantiateEJBLocalObjectImpl, instantiateEJBLocalObjectImpl, instantiateEJBObjectImpl, instantiateEJBObjectImpl, instantiateOptionalEJBLocalBusinessObjectImpl, instantiateRemoteBusinessObjectImpl, intercept, intercept, invokeBeanMethod, invokeFindByPrimaryKey, invokeTargetBeanMethod, isApplicationException, isCreateHomeFinder, isEjbTimeoutMethod, isHAEnabled, isLocalInterfaceSupported, isLocalObject, isRemoteInterfaceSupported, isRemoteObject, isStopped, isSystemUncheckedException, isTimedObject, isUndeployed, lookupExtendedEntityManager, onEnteringContainer, onLeavingContainer, onShutdown, onTermination, postCreate, postEjbTimeout, postFind, postInvoke, postInvoke, postInvokeNoTx, postInvokeTx, postProcessInvocationInfo, preInitialize, preInvoke, preInvokeNoTx, preInvokeTx, prepareEjbTimeoutParams, preSelect, registerTimerMonitorableComponent, releaseTargetObject, removeBeanUnchecked, removeBeanUnchecked, setDebugMonitorFlag, setEJBMetaData, setStartedState, setStoppedState, setUndeployedState, startApplication, toString, undeploy, useClientTx, validateEMForClientTx, validateTxAttr, webServicePostInvoke
-
-
-
-
Field Detail
-
pool
protected AbstractPool pool
-
-
Constructor Detail
-
StatelessSessionContainer
protected StatelessSessionContainer(BaseContainer.ContainerType conType, EjbDescriptor desc, ClassLoader loader, com.sun.enterprise.security.SecurityManager sm) throws Exception
- Throws:
Exception
-
-
Method Detail
-
getMonitorAttributeValues
public String getMonitorAttributeValues()
-
suspendTransaction
protected boolean suspendTransaction(EjbInvocation inv) throws Exception
- Overrides:
suspendTransactionin classBaseContainer- Throws:
Exception
-
resumeTransaction
protected boolean resumeTransaction(EjbInvocation inv) throws Exception
- Overrides:
resumeTransactionin classBaseContainer- Throws:
Exception
-
scanForEjbCreateMethod
public boolean scanForEjbCreateMethod()
- Overrides:
scanForEjbCreateMethodin classBaseContainer
-
getMonitoringStatsProvider
protected EjbMonitoringStatsProvider getMonitoringStatsProvider(String appName, String modName, String ejbName)
- Specified by:
getMonitoringStatsProviderin classBaseContainer
-
initializeHome
protected void initializeHome() throws ExceptionDescription copied from class:BaseContainerCalled from the ContainerFactory during initialization.- Overrides:
initializeHomein classBaseContainer- Throws:
Exception
-
createBeanPool
protected void createBeanPool()
-
registerMonitorableComponents
protected void registerMonitorableComponents()
- Overrides:
registerMonitorableComponentsin classBaseContainer
-
onReady
public void onReady()
Description copied from class:BaseContainerCalled when server instance is Ready- Specified by:
onReadyin interfaceContainer- Overrides:
onReadyin classBaseContainer
-
createRemoteBusinessObjectImpl
public EJBObjectImpl createRemoteBusinessObjectImpl() throws jakarta.ejb.CreateException, RemoteException
- Throws:
jakarta.ejb.CreateExceptionRemoteException
-
createEJBObjectImpl
public EJBObjectImpl createEJBObjectImpl() throws jakarta.ejb.CreateException, RemoteException
- Specified by:
createEJBObjectImplin classBaseContainer- Throws:
jakarta.ejb.CreateExceptionRemoteException
-
createEJBLocalObjectImpl
public EJBLocalObjectImpl createEJBLocalObjectImpl() throws jakarta.ejb.CreateException
Called during client creation request through EJB LocalHome view.- Overrides:
createEJBLocalObjectImplin classBaseContainer- Throws:
jakarta.ejb.CreateException
-
createEJBLocalBusinessObjectImpl
public EJBLocalObjectImpl createEJBLocalBusinessObjectImpl(boolean localBeanView) throws jakarta.ejb.CreateException
Called during internal creation of session bean- Throws:
jakarta.ejb.CreateException
-
removeBean
protected void removeBean(EJBLocalRemoteObject ejbo, Method removeMethod, boolean local) throws jakarta.ejb.RemoveException, jakarta.ejb.EJBException, RemoteException
- Specified by:
removeBeanin classBaseContainer- Throws:
jakarta.ejb.RemoveExceptionjakarta.ejb.EJBExceptionRemoteException
-
forceDestroyBean
protected void forceDestroyBean(EJBContextImpl sc)
Force destroy the EJB. Called from postInvokeTx. Note: EJB2.0 section 18.3.1 says that discarding an EJB means that no methods other than finalize() should be invoked on it.- Specified by:
forceDestroyBeanin classBaseContainer
-
getEJBObjectImpl
protected EJBObjectImpl getEJBObjectImpl(byte[] instanceKey)
Called when a remote invocation arrives for an EJB.- Specified by:
getEJBObjectImplin classBaseContainer
-
getEJBLocalObjectImpl
protected EJBLocalObjectImpl getEJBLocalObjectImpl(Object key)
Called from EJBLocalObjectImpl.getLocalObject() while deserializing a local object reference.- Overrides:
getEJBLocalObjectImplin classBaseContainer
-
_getContext
protected ComponentContext _getContext(EjbInvocation inv)
Called from preInvoke which is called from the EJBObject for local and remote invocations.- Specified by:
_getContextin classBaseContainer
-
_constructEJBContextImpl
protected EJBContextImpl _constructEJBContextImpl(Object instance)
- Overrides:
_constructEJBContextImplin classBaseContainer
-
doTimerInvocationInit
protected void doTimerInvocationInit(EjbInvocation inv, Object primaryKey) throws Exception
Description copied from class:BaseContainerThis is implemented by concrete containers that support TimedObjects.- Overrides:
doTimerInvocationInitin classBaseContainer- Throws:
Exception
-
userTransactionMethodsAllowed
public boolean userTransactionMethodsAllowed(org.glassfish.api.invocation.ComponentInvocation inv)
Description copied from class:BaseContainerEJB spec makes a distinction between access to the UserTransaction object itself and access to its methods. getUserTransaction covers the first check and this method covers the second. It is called by the UserTransaction implementation to verify access.- Specified by:
userTransactionMethodsAllowedin interfaceContainer- Overrides:
userTransactionMethodsAllowedin classBaseContainer
-
releaseContext
public void releaseContext(EjbInvocation inv)
Called from preInvoke which is called from the EJBObject for local and remote invocations.- Specified by:
releaseContextin classBaseContainer
-
isIdentical
protected boolean isIdentical(EJBObjectImpl ejbo, jakarta.ejb.EJBObject other) throws RemoteException
- Overrides:
isIdenticalin classBaseContainer- Throws:
RemoteException
-
checkExists
protected void checkExists(EJBLocalRemoteObject ejbObj)
Check if the given EJBObject/LocalObject has been removed.- Overrides:
checkExistsin classBaseContainer- Throws:
jakarta.ejb.NoSuchObjectLocalException- if the object has been removed.
-
afterBegin
protected void afterBegin(EJBContextImpl context)
- Specified by:
afterBeginin classBaseContainer
-
beforeCompletion
protected void beforeCompletion(EJBContextImpl context)
- Specified by:
beforeCompletionin classBaseContainer
-
afterCompletion
protected void afterCompletion(EJBContextImpl ctx, int status)
- Specified by:
afterCompletionin classBaseContainer
-
passivateEJB
public boolean passivateEJB(ComponentContext context)
- Specified by:
passivateEJBin classBaseContainer
-
doConcreteContainerShutdown
protected void doConcreteContainerShutdown(boolean appBeingUndeployed)
TODO ??? public void appendStats(StringBuffer sbuf) { sbuf.append("\nStatelessContainer: ") .append("CreateCount=").append(statCreateCount).append("; ") .append("RemoveCount=").append(statRemoveCount).append("; ") .append("]"); }- Specified by:
doConcreteContainerShutdownin classBaseContainer
-
getMethodReadyCount
public long getMethodReadyCount()
-
getMaxPoolSize
public int getMaxPoolSize()
-
getSteadyPoolSize
public int getSteadyPoolSize()
-
-