Package com.sun.ejb.containers
Class StatelessSessionContainer
- java.lang.Object
-
- com.sun.ejb.containers.BaseContainer
-
- com.sun.ejb.containers.StatelessSessionContainer
-
- All Implemented Interfaces:
Container
,JavaEEContainer
,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 three states of a Stateless EJB (an EJB can be in only one state at a time):
- POOLED : ready for invocations, no transaction in progress
- INVOKING : processing an invocation
- 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. It is 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 class
StatelessSessionContainer.SessionContextFactory
-
Nested classes/interfaces inherited from class com.sun.ejb.containers.BaseContainer
BaseContainer.ContainerInfo, BaseContainer.ContainerType, BaseContainer.PreInvokeException
-
-
Field Summary
-
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, executorProbeListener, hasLocalBusinessView, hasLocalHomeView, hasOptionalLocalBusinessView, hasRemoteBusinessView, hasRemoteHomeView, homeIntf, injectionManager, interceptorManager, invocationInfoMap, invocationManager, isBeanManagedTran, isLocal, isMessageDriven, isRemote, isSession, isSingleton, isStatefulSession, isStatelessSession, isWebServiceEndpoint, jcdiService, loader, localBusinessHomeIntf, localBusinessIntfs, localHomeIntf, logParams, metadata, 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 protected
StatelessSessionContainer(BaseContainer.ContainerType conType, EjbDescriptor desc, ClassLoader loader, SecurityManager sm)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected SessionContextImpl
_constructEJBContextImpl(Object instance)
Must be overridden for any container that supports injectionprotected ComponentContext
_getContext(EjbInvocation inv)
Called from preInvoke which is called from the EJBObject for local and remote invocations.void
activateEJB(Object ctx, Object instanceKey)
Deprecated.not called and not used in Payara 5protected void
afterBegin(EJBContextImpl context)
protected void
afterCompletion(EJBContextImpl ctx, int status)
protected void
beforeCompletion(EJBContextImpl context)
protected void
checkExists(EJBLocalRemoteObject ejbObj)
Check if the given EJBObject/LocalObject has been removed.protected void
createBeanPool()
EJBLocalObjectImpl
createEJBLocalBusinessObjectImpl(boolean localBeanView)
Called during internal creation of session beanEJBLocalObjectImpl
createEJBLocalObjectImpl()
Called during client creation request through EJB LocalHome view.EJBObjectImpl
createEJBObjectImpl()
EJBObjectImpl
createRemoteBusinessObjectImpl()
protected void
doConcreteContainerShutdown(boolean appBeingUndeployed)
protected void
doTimerInvocationInit(EjbInvocation inv, Object primaryKey)
This is implemented by concrete containers that support TimedObjects.protected void
forceDestroyBean(EJBContextImpl sc)
Force destroy the EJB.protected EJBLocalObjectImpl
getEJBLocalObjectImpl(Object key)
Called from EJBLocalObjectImpl.getLocalObject() while deserializing a local object reference.protected EJBObjectImpl
getEJBObjectImpl(byte[] instanceKey)
Called when a remote invocation arrives for an EJB.int
getMaxPoolSize()
long
getMethodReadyCount()
String
getMonitorAttributeValues()
protected EjbMonitoringStatsProvider
getMonitoringStatsProvider(String appName, String modName, String ejbName)
int
getSteadyPoolSize()
protected void
initializeHome()
Called from the ContainerFactory during initialization.protected boolean
isIdentical(EJBObjectImpl ejbo, jakarta.ejb.EJBObject other)
void
onReady()
Called when server instance is Readyboolean
passivateEJB(ComponentContext context)
protected void
registerMonitorableComponents()
void
releaseContext(EjbInvocation inv)
Called from preInvoke which is called from the EJBObject for local and remote invocations.protected void
removeBean(EJBLocalRemoteObject ejbo, Method removeMethod, boolean local)
protected boolean
resumeTransaction(EjbInvocation inv)
boolean
scanForEjbCreateMethod()
protected boolean
suspendTransaction(EjbInvocation inv)
boolean
userTransactionMethodsAllowed(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, _createJCDIInjectionContext, _createJCDIInjectionContext, addInvocationInfo, addLocalRemoteInvocationInfo, addProxyInterfacesSetClass, adjustHomeTargetMethodInfo, adjustInvocationInfo, assertValidLocalObject, assertValidRemoteObject, authorize, authorizeLocalGetPrimaryKey, authorizeLocalMethod, authorizeRemoteGetPrimaryKey, authorizeRemoteMethod, callEJBTimeout, cancelTimers, checkExceptionClientTx, checkUnfinishedTx, checkUserTransactionLookup, cleanupInstance, containerStateToString, createCallFlowAgent, createEjbInstanceAndContext, createEjbInstanceForInterceptors, createEjbInvocation, createEjbInvocation, createEmptyContextAndInterceptors, 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, initialize, initializeProtocolManager, injectEjbInstance, instantiateEJBLocalBusinessObjectImpl, instantiateEJBLocalObjectImpl, instantiateEJBLocalObjectImpl, instantiateEJBObjectImpl, instantiateEJBObjectImpl, instantiateOptionalEJBLocalBusinessObjectImpl, instantiateRemoteBusinessObjectImpl, intercept, intercept, invokeBeanMethod, invokeFindByPrimaryKey, invokeTargetBeanMethod, isApplicationException, isCreateHomeFinder, isEjbTimeoutMethod, isHAEnabled, isJCDIEnabled, 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
-
-
-
-
Constructor Detail
-
StatelessSessionContainer
protected StatelessSessionContainer(BaseContainer.ContainerType conType, EjbDescriptor desc, ClassLoader loader, SecurityManager sm) throws Exception
- Throws:
Exception
-
-
Method Detail
-
getMonitorAttributeValues
public String getMonitorAttributeValues()
-
suspendTransaction
protected boolean suspendTransaction(EjbInvocation inv) throws Exception
- Overrides:
suspendTransaction
in classBaseContainer
- Throws:
Exception
-
resumeTransaction
protected boolean resumeTransaction(EjbInvocation inv) throws Exception
- Overrides:
resumeTransaction
in classBaseContainer
- Throws:
Exception
-
scanForEjbCreateMethod
public boolean scanForEjbCreateMethod()
- Overrides:
scanForEjbCreateMethod
in classBaseContainer
-
getMonitoringStatsProvider
protected EjbMonitoringStatsProvider getMonitoringStatsProvider(String appName, String modName, String ejbName)
- Specified by:
getMonitoringStatsProvider
in classBaseContainer
-
initializeHome
protected void initializeHome() throws Exception
Description copied from class:BaseContainer
Called from the ContainerFactory during initialization.- Overrides:
initializeHome
in classBaseContainer
- Throws:
Exception
-
createBeanPool
protected void createBeanPool()
-
registerMonitorableComponents
protected void registerMonitorableComponents()
- Overrides:
registerMonitorableComponents
in classBaseContainer
-
onReady
public void onReady()
Description copied from class:BaseContainer
Called when server instance is Ready- Specified by:
onReady
in interfaceContainer
- Overrides:
onReady
in classBaseContainer
-
createRemoteBusinessObjectImpl
public EJBObjectImpl createRemoteBusinessObjectImpl() throws jakarta.ejb.CreateException, RemoteException
- Throws:
jakarta.ejb.CreateException
RemoteException
-
createEJBObjectImpl
public EJBObjectImpl createEJBObjectImpl() throws jakarta.ejb.CreateException, RemoteException
- Specified by:
createEJBObjectImpl
in classBaseContainer
- Throws:
jakarta.ejb.CreateException
RemoteException
-
createEJBLocalObjectImpl
public EJBLocalObjectImpl createEJBLocalObjectImpl() throws jakarta.ejb.CreateException
Called during client creation request through EJB LocalHome view.- Overrides:
createEJBLocalObjectImpl
in 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:
removeBean
in classBaseContainer
- Throws:
jakarta.ejb.RemoveException
jakarta.ejb.EJBException
RemoteException
-
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:
forceDestroyBean
in classBaseContainer
-
getEJBObjectImpl
protected EJBObjectImpl getEJBObjectImpl(byte[] instanceKey)
Called when a remote invocation arrives for an EJB.- Specified by:
getEJBObjectImpl
in classBaseContainer
-
getEJBLocalObjectImpl
protected EJBLocalObjectImpl getEJBLocalObjectImpl(Object key)
Called from EJBLocalObjectImpl.getLocalObject() while deserializing a local object reference.- Overrides:
getEJBLocalObjectImpl
in classBaseContainer
-
_getContext
protected ComponentContext _getContext(EjbInvocation inv)
Called from preInvoke which is called from the EJBObject for local and remote invocations.- Specified by:
_getContext
in classBaseContainer
-
_constructEJBContextImpl
protected SessionContextImpl _constructEJBContextImpl(Object instance)
Description copied from class:BaseContainer
Must be overridden for any container that supports injection- Overrides:
_constructEJBContextImpl
in classBaseContainer
- Returns:
EJBContextImpl
-
doTimerInvocationInit
protected void doTimerInvocationInit(EjbInvocation inv, Object primaryKey) throws Exception
Description copied from class:BaseContainer
This is implemented by concrete containers that support TimedObjects.- Overrides:
doTimerInvocationInit
in classBaseContainer
- Throws:
Exception
-
userTransactionMethodsAllowed
public boolean userTransactionMethodsAllowed(ComponentInvocation inv)
Description copied from class:BaseContainer
EJB 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:
userTransactionMethodsAllowed
in interfaceContainer
- Overrides:
userTransactionMethodsAllowed
in classBaseContainer
-
releaseContext
public void releaseContext(EjbInvocation inv)
Called from preInvoke which is called from the EJBObject for local and remote invocations.- Specified by:
releaseContext
in classBaseContainer
-
isIdentical
protected boolean isIdentical(EJBObjectImpl ejbo, jakarta.ejb.EJBObject other) throws RemoteException
- Overrides:
isIdentical
in classBaseContainer
- Throws:
RemoteException
-
checkExists
protected void checkExists(EJBLocalRemoteObject ejbObj)
Check if the given EJBObject/LocalObject has been removed.- Overrides:
checkExists
in classBaseContainer
- Throws:
jakarta.ejb.NoSuchObjectLocalException
- if the object has been removed.
-
afterBegin
protected void afterBegin(EJBContextImpl context)
- Specified by:
afterBegin
in classBaseContainer
-
beforeCompletion
protected void beforeCompletion(EJBContextImpl context)
- Specified by:
beforeCompletion
in classBaseContainer
-
afterCompletion
protected void afterCompletion(EJBContextImpl ctx, int status)
- Specified by:
afterCompletion
in classBaseContainer
-
passivateEJB
public boolean passivateEJB(ComponentContext context)
- Specified by:
passivateEJB
in classBaseContainer
-
activateEJB
@Deprecated public void activateEJB(Object ctx, Object instanceKey)
Deprecated.not called and not used in Payara 5- Parameters:
ctx
-instanceKey
-
-
doConcreteContainerShutdown
protected void doConcreteContainerShutdown(boolean appBeingUndeployed)
- Specified by:
doConcreteContainerShutdown
in classBaseContainer
-
getMethodReadyCount
public long getMethodReadyCount()
-
getMaxPoolSize
public int getMaxPoolSize()
-
getSteadyPoolSize
public int getSteadyPoolSize()
-
-