java.lang.Object
com.sun.ejb.containers.BaseContainer
org.glassfish.persistence.ejb.entitybean.container.EntityContainer
All Implemented Interfaces:
com.sun.appserv.util.cache.CacheListener, com.sun.ejb.Container, com.sun.enterprise.container.common.spi.JavaEEContainer, org.glassfish.enterprise.iiop.spi.EjbContainerFacade
Direct Known Subclasses:
CommitCEntityContainer, ReadOnlyBeanContainer

public class EntityContainer extends com.sun.ejb.containers.BaseContainer implements com.sun.appserv.util.cache.CacheListener
This class implements the Container interface for EntityBeans. It is responsible for instance & lifecycle management for BMP & CMP EntityBeans. The EntityContainer implements option B of the commit-time options described in the EJB2.0 spec section 10.5.9 It also implements optimistic concurrency (i.e. multiple non-exclusive bean instances per primary key) when there are multiple concurrent transactions on a EntityBean.

The following sequence of actions happens for the EntityContainer, for each EJB lifecycle stage (note: getEJBObject, getContext, releaseContext, preInvokeTx, postInvokeTx are called from BaseContainer). 1. EJB Creation homeImpl.create, container.getContext, container.preInvokeTx, ejb.ejbCreate, container.postCreate, ejb.ejbPostCreate, container.postInvokeTx, container.releaseContext 2. EJB Finding homeImpl.find---, container.getContext, container.preInvokeTx, ejb.ejbFind---, container.postFind, container.postInvokeTx, container.releaseContext 3. EJB Invocation container.getEJBObject, ejbObject.someMethod, container.getContext, container.preInvokeTx, ejb.someMethod, container.postInvokeTx, container.releaseContext

State Management: The EntityContainer manages collections of EJBs in different states. The 5 states of an EntityBean (an EJB can be in only 1 state at a time):

  • 1. POOLED : does not have identity. EJBs in the POOLED state are all identical, hence are maintained in a java.util.Vector, whose size is maintained below a HIGH_WATER_MARK (currently 100).
  • 2. READY : ready for invocations, no transaction in progress. EJBs in the READY state are associated with a primary key. To enhance reuse of EJB instances, only one READY EJB per primary key is stored. READY EJBs are managed by the ejbstore/EntityStore class. READY EJBs are looked up using a key consisting of the primary key and a null transaction context.
  • 3. INVOKING : processing an invocation. EJBs in the INVOKING state are not stored anywhere. Before transitioning from READY or INCOMPLETE_TX to INVOKING, the EJB is removed from the EntityStore.
  • 4. INCOMPLETE_TX : ready for invocations, transaction in progress. EJBs in the INCOMPLETE_TX state are associated with a primary key. INCOMPLETE_TX EJBs are managed by the ejbstore/EntityStore class. INCOMPLETE_TX EJBs are looked up using a composite key consisting of the primary key and the transaction context.
  • 5. DESTROYED : does not exist.
All READY bean instances are stored in the readyStore. All INCOMPLETE_TX bean instances are stored in the ActiveTxCache. Beans in the READY state are stored with key = ejbObject. Beans in the INCOMPLETE_TX state are stored with key = ejbObject+Tx. Instances in INVOKING state which have transactions associated with them are also in ActiveTxCache. All POOLED instances are stored in the pooledEJBs vector. Note on locking order: if both ready/ActiveTxCache and context are to be locked, always acquire the context lock first, then the Store lock. Note on locking order: if both ready/ActiveTxCache and ejbObject need locks, always acquire the ejbObject lock first, then the Store lock.
Author:
Mahesh Kannan, Shanker N, Pramod Gopinath
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    protected static class 
     
    protected class 
     
    protected class 
     

    Nested classes/interfaces inherited from class com.sun.ejb.containers.BaseContainer

    com.sun.ejb.containers.BaseContainer.ContainerInfo, com.sun.ejb.containers.BaseContainer.ContainerType, com.sun.ejb.containers.BaseContainer.PreInvokeException
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected int
     
    protected org.glassfish.ejb.deployment.descriptor.runtime.BeanCacheDescriptor
     
    protected com.sun.enterprise.deployment.runtime.BeanPoolDescriptor
     
    protected final int
     
    protected final float
     
    protected boolean
     
    protected org.glassfish.ejb.config.EjbContainer
     
    protected EJBObjectCache
     
    protected EJBObjectCache
     
    protected int
     
    protected com.sun.ejb.containers.util.pool.AbstractPool
     
    protected static final int
     
    protected org.glassfish.ejb.deployment.descriptor.runtime.IASEjbExtraDescriptors
     
    protected org.glassfish.persistence.ejb.entitybean.container.EntityContainer.IdleBeansPassivator
     
    protected org.glassfish.persistence.ejb.entitybean.container.EntityContainer.IdleBeansPassivator
     
    protected boolean
     
    protected boolean
     
    protected Stack
     
    protected com.sun.appserv.util.cache.Cache
     
    protected int
     
    protected int
     

    Fields inherited from class com.sun.ejb.containers.BaseContainer

    cacheProbeListener, cacheProbeNotifier, callFlowInfo, componentId, CONTAINER_INITIALIZING, CONTAINER_ON_HOLD, CONTAINER_STARTED, CONTAINER_STOPPED, CONTAINER_UNDEPLOYED, containerInfo, containerState, containerStateManager, containerTransactionManager, 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, 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
    protected
    EntityContainer(com.sun.ejb.containers.BaseContainer.ContainerType containerType, org.glassfish.ejb.deployment.descriptor.EjbDescriptor desc, ClassLoader loader, com.sun.enterprise.security.SecurityManager sm)
     
    protected
    EntityContainer(org.glassfish.ejb.deployment.descriptor.EjbDescriptor desc, ClassLoader loader, com.sun.enterprise.security.SecurityManager sm)
    This constructor is called from the JarManager when a Jar is deployed.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected com.sun.ejb.ComponentContext
    _getContext(com.sun.ejb.EjbInvocation inv)
    Called from BaseContainer.preInvoke which is called from the EJBObject for local and remote invocations, and from the EJBHome for create/find.
    activateEJBFromPool(Object primaryKey, com.sun.ejb.EjbInvocation inv)
    Called from getContext and getEJBWithIncompleteTx Get an EJB in the ready state (i.e.
    protected void
     
    protected void
    addProxyInterfacesSetClass(Set proxyInterfacesSet, boolean local)
     
    protected void
     
    protected void
    adjustHomeTargetMethodInfo(com.sun.ejb.InvocationInfo invInfo, String methodName, Class[] paramTypes)
     
    protected void
    adjustInvocationInfo(com.sun.ejb.InvocationInfo invInfo, Method method, int txAttr, boolean flushEnabled, String methodIntf, Class originalIntf)
     
    protected void
    afterBegin(com.sun.ejb.containers.EJBContextImpl ctx)
     
    protected void
    afterCompletion(com.sun.ejb.containers.EJBContextImpl ctx, int status)
     
    protected void
     
    protected void
    authorizeLocalGetPrimaryKey(com.sun.ejb.containers.EJBLocalRemoteObject ejbObj)
     
    protected void
    authorizeRemoteGetPrimaryKey(com.sun.ejb.containers.EJBLocalRemoteObject ejbObj)
     
    protected void
    beforeCompletion(com.sun.ejb.containers.EJBContextImpl ctx)
     
    protected void
    callEJBLoad(jakarta.ejb.EntityBean ejb, EntityContextImpl context, boolean activeTx)
     
    protected void
    callEJBRemove(jakarta.ejb.EntityBean ejb, EntityContextImpl context)
     
    protected void
    callEJBStore(jakarta.ejb.EntityBean ejb, EntityContextImpl context)
     
    void
    cancel a timer task to trim timed out entries in the cache.
    protected void
    checkExists(com.sun.ejb.containers.EJBLocalRemoteObject ejbObj)
    Check if the given EJBObject/LocalObject has been removed.
    protected void
    checkUnfinishedTx(jakarta.transaction.Transaction prevTx, com.sun.ejb.EjbInvocation inv)
     
    protected com.sun.ejb.containers.EJBLocalObjectImpl
     
    protected com.sun.ejb.containers.EJBObjectImpl
    Implementation of BaseContainer method.
    protected void
    createEJBObjectStores(int cacheSize, int numberOfVictimsToSelect, long idleTimeout)
     
    createEntityContextInstance(jakarta.ejb.EntityBean ejb, EntityContainer entityContainer)
     
    protected void
    createReadyStore(int cacheSize, int numberOfVictimsToSelect, float loadFactor, long idleTimeout)
     
    protected void
     
    protected void
    doConcreteContainerShutdown(boolean appBeingUndeployed)
     
    protected void
    doEJBHomeRemove(Object primaryKey, Method removeMethod, boolean local)
     
    protected void
    doFlush(com.sun.ejb.EjbInvocation inv)
     
    protected void
    doTimerInvocationInit(com.sun.ejb.EjbInvocation inv, Object primaryKey)
     
    protected void
    forceDestroyBean(com.sun.ejb.containers.EJBContextImpl ctx)
    Discard the bean instance.
    protected com.sun.ejb.containers.EJBHomeInvocationHandler
     
    protected com.sun.ejb.containers.EJBLocalHomeInvocationHandler
     
    jakarta.ejb.EJBLocalObject
    Called only from the Persistence Manager for EJB2.0 CMP EntityBeans.
    jakarta.ejb.EJBLocalObject
    getEJBLocalObjectForPrimaryKey(Object pkey, jakarta.ejb.EJBContext ctx)
    Called only from the Persistence Manager for EJB2.0 CMP EntityBeans.
    protected com.sun.ejb.containers.EJBLocalObjectImpl
    Called from EJBLocalObjectImpl.getLocalObject() while deserializing a local object reference.
    jakarta.ejb.EJBObject
    Called only from the Persistence Manager for EJB2.0 CMP EntityBeans.
    protected com.sun.ejb.containers.EJBObjectImpl
    getEJBObjectImpl(byte[] streamKey)
    Called when a remote EjbInvocation arrives for an EJB.
    int
     
    int
     
    protected com.sun.ejb.monitoring.stats.EjbMonitoringStatsProvider
    getMonitoringStatsProvider(String appName, String modName, String ejbName)
     
    long
     
     
    long
     
    getReadyEJB(com.sun.ejb.EjbInvocation inv)
     
    int
     
    protected void
    Called from the ContainerFactory during initialization.
    protected com.sun.ejb.containers.EJBLocalObjectImpl
    The following are private methods for implementing internal logic for lifecyle and state management, in a reusable way.
    protected com.sun.ejb.containers.EJBLocalObjectImpl
    internalGetEJBLocalObjectImpl(Object primaryKey, boolean incrementRefCount)
     
    protected com.sun.ejb.containers.EJBLocalObjectImpl
    internalGetEJBLocalObjectImpl(Object primaryKey, boolean incrementRefCount, boolean cacheEJBO)
     
    protected Object
    invokeFindByPrimaryKey(Method method, com.sun.ejb.EjbInvocation inv, Object[] args)
     
    protected boolean
    isIdentical(com.sun.ejb.containers.EJBObjectImpl ejbObjImpl, jakarta.ejb.EJBObject other)
     
    void
     
    protected void
     
    protected boolean
    passivateEJB(com.sun.ejb.ComponentContext ctx)
     
    void
    postCreate(com.sun.ejb.EjbInvocation inv, Object primaryKey)
    This is called from the generated "HelloEJBHomeImpl" create* method, after ejb.ejbCreate() has been called and before ejb.ejbPostCreate() is called.
    postFind(com.sun.ejb.EjbInvocation inv, Object primaryKeys, Object[] findParams)
    Convert a collection of primary keys to a collection of EJBObjects.
    protected void
    postInvokeNoTx(com.sun.ejb.EjbInvocation inv)
     
    protected com.sun.ejb.InvocationInfo
    postProcessInvocationInfo(com.sun.ejb.InvocationInfo invInfo)
     
    protected void
    preCreate(com.sun.ejb.EjbInvocation inv, EntityContextImpl context)
    Called from getContext before the ejb.ejbCreate is called
    protected void
    preFind(com.sun.ejb.EjbInvocation inv, EntityContextImpl context)
    Called from getContext before the ejb.ejbFind* is called
    protected void
    preInitialize(org.glassfish.ejb.deployment.descriptor.EjbDescriptor desc, ClassLoader loader)
     
    protected void
    preInvokeNoTx(com.sun.ejb.EjbInvocation inv)
     
    void
    Called from CMP PersistentManager
    protected void
     
    void
    releaseContext(com.sun.ejb.EjbInvocation inv)
    This is called from BaseContainer.postInvoke after EntityContainer.preInvokeTx has been called.
    protected void
    removeBean(com.sun.ejb.containers.EJBLocalRemoteObject ejbo, Method removeMethod, boolean local)
     
    protected void
    removeBean(com.sun.ejb.EjbInvocation inv)
    container.preInvoke() must already be done.
    void
    removeBeanUnchecked(jakarta.ejb.EJBLocalObject localObj)
    Remove a bean.
    void
    Remove a bean.
    protected void
     
    protected void
    removeIncompleteTxEJB(EntityContextImpl context, boolean updateTxBeanTable)
    Called from releaseContext if ejb is removed, from afterCompletion, and from passivateEJB.
    protected void
     
    org.glassfish.persistence.ejb.entitybean.container.EntityContainer.IdleBeansPassivator
    setupIdleBeansPassivator(com.sun.appserv.util.cache.Cache cache)
    setup a timer task to trim timed out entries in the cache.
    void
    trimEvent(Object primaryKey, Object context)
     
    protected void
    validateTxAttr(com.sun.enterprise.deployment.MethodDescriptor md, int txAttr)
     
    protected boolean
    willInvokeWithClientTx(com.sun.ejb.EjbInvocation inv)
     

    Methods inherited from class com.sun.ejb.containers.BaseContainer

    _constructEJBContextImpl, _constructEJBInstance, addInvocationInfo, addLocalRemoteInvocationInfo, assertValidLocalObject, assertValidRemoteObject, authorize, authorizeLocalMethod, authorizeRemoteMethod, callEJBTimeout, cancelTimers, checkExceptionClientTx, checkUserTransactionLookup, cleanupInstance, containerStateToString, createCallFlowAgent, createEjbInstanceAndContext, createEjbInstanceForInterceptors, createEjbInvocation, createEjbInvocation, createMonitoringRegistry, createRemoteReferenceWithId, delistExtendedEntityManagers, doAfterBegin, enlistExtendedEntityManagers, externalPostInvoke, externalPreInvoke, findFlushEnabledAttr, getApplicationId, getClassLoader, getComponentId, getContainerClassLoader, getContainerId, getContainerInfo, getContext, getDebugMonitorFlag, getDescriptor, getEJBClass, getEjbDescriptor, getEJBHome, getEJBHomeStub, getEJBLocalBusinessHome, getEJBLocalHome, getEJBMetaData, 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, invokeTargetBeanMethod, isApplicationException, isCreateHomeFinder, isEjbTimeoutMethod, isHAEnabled, isLocalInterfaceSupported, isLocalObject, isRemoteInterfaceSupported, isRemoteObject, isStopped, isSystemUncheckedException, isTimedObject, isUndeployed, lookupExtendedEntityManager, onEnteringContainer, onLeavingContainer, onShutdown, onTermination, postEjbTimeout, postInvoke, postInvoke, postInvokeTx, preInvoke, preInvokeTx, prepareEjbTimeoutParams, registerSystemInterceptor, registerTimerMonitorableComponent, releaseTargetObject, resumeTransaction, scanForEjbCreateMethod, setDebugMonitorFlag, setStartedState, setStoppedState, setUndeployedState, startApplication, suspendTransaction, toString, undeploy, useClientTx, userTransactionMethodsAllowed, validateEMForClientTx, webServicePostInvoke

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • HIGH_WATER_MARK

      protected static final int HIGH_WATER_MARK
      See Also:
    • ejbObjectStore

      protected EJBObjectCache ejbObjectStore
    • ejbLocalObjectStore

      protected EJBObjectCache ejbLocalObjectStore
    • passivationCandidates

      protected Stack passivationCandidates
    • readyStore

      protected com.sun.appserv.util.cache.Cache readyStore
    • entityCtxPool

      protected com.sun.ejb.containers.util.pool.AbstractPool entityCtxPool
    • isReentrant

      protected boolean isReentrant
    • isContainerManagedPers

      protected boolean isContainerManagedPers
    • DEFAULT_LOAD_FACTOR

      protected final float DEFAULT_LOAD_FACTOR
      See Also:
    • DEFAULT_CACHE_SIZE

      protected final int DEFAULT_CACHE_SIZE
      See Also:
    • _maxBuckets

      protected int _maxBuckets
    • iased

      protected org.glassfish.ejb.deployment.descriptor.runtime.IASEjbExtraDescriptors iased
    • beanCacheDes

      protected org.glassfish.ejb.deployment.descriptor.runtime.BeanCacheDescriptor beanCacheDes
    • beanPoolDes

      protected com.sun.enterprise.deployment.runtime.BeanPoolDescriptor beanPoolDes
    • ejbContainer

      protected org.glassfish.ejb.config.EjbContainer ejbContainer
    • idleEJBObjectPassivator

      protected org.glassfish.persistence.ejb.entitybean.container.EntityContainer.IdleBeansPassivator idleEJBObjectPassivator
    • idleLocalEJBObjectPassivator

      protected org.glassfish.persistence.ejb.entitybean.container.EntityContainer.IdleBeansPassivator idleLocalEJBObjectPassivator
    • defaultCacheEJBO

      protected boolean defaultCacheEJBO
    • ejboRemoved

      protected int ejboRemoved
    • totalPassivations

      protected int totalPassivations
    • totalPassivationErrors

      protected int totalPassivationErrors
  • Constructor Details

    • EntityContainer

      protected EntityContainer(org.glassfish.ejb.deployment.descriptor.EjbDescriptor desc, ClassLoader loader, com.sun.enterprise.security.SecurityManager sm) throws Exception
      This constructor is called from the JarManager when a Jar is deployed.
      Throws:
      Exception - on error
    • EntityContainer

      protected EntityContainer(com.sun.ejb.containers.BaseContainer.ContainerType containerType, org.glassfish.ejb.deployment.descriptor.EjbDescriptor desc, ClassLoader loader, com.sun.enterprise.security.SecurityManager sm) throws Exception
      Throws:
      Exception
  • Method Details

    • preInitialize

      protected void preInitialize(org.glassfish.ejb.deployment.descriptor.EjbDescriptor desc, ClassLoader loader)
      Overrides:
      preInitialize in class com.sun.ejb.containers.BaseContainer
    • setEJBMetaData

      protected void setEJBMetaData() throws Exception
      Overrides:
      setEJBMetaData in class com.sun.ejb.containers.BaseContainer
      Throws:
      Exception
    • validateTxAttr

      protected void validateTxAttr(com.sun.enterprise.deployment.MethodDescriptor md, int txAttr) throws jakarta.ejb.EJBException
      Overrides:
      validateTxAttr in class com.sun.ejb.containers.BaseContainer
      Throws:
      jakarta.ejb.EJBException
    • adjustHomeTargetMethodInfo

      protected void adjustHomeTargetMethodInfo(com.sun.ejb.InvocationInfo invInfo, String methodName, Class[] paramTypes) throws NoSuchMethodException
      Overrides:
      adjustHomeTargetMethodInfo in class com.sun.ejb.containers.BaseContainer
      Throws:
      NoSuchMethodException
    • getEJBHomeInvocationHandler

      protected com.sun.ejb.containers.EJBHomeInvocationHandler getEJBHomeInvocationHandler(Class homeIntfClass) throws Exception
      Overrides:
      getEJBHomeInvocationHandler in class com.sun.ejb.containers.BaseContainer
      Throws:
      Exception
    • getEJBLocalHomeInvocationHandler

      protected com.sun.ejb.containers.EJBLocalHomeInvocationHandler getEJBLocalHomeInvocationHandler(Class homeIntfClass) throws Exception
      Overrides:
      getEJBLocalHomeInvocationHandler in class com.sun.ejb.containers.BaseContainer
      Throws:
      Exception
    • setupIdleBeansPassivator

      public org.glassfish.persistence.ejb.entitybean.container.EntityContainer.IdleBeansPassivator setupIdleBeansPassivator(com.sun.appserv.util.cache.Cache cache) throws Exception
      setup a timer task to trim timed out entries in the cache.
      Parameters:
      cache - cache which is used to setup the timer task
      Returns:
      the passivator object
      Throws:
      Exception
    • cancelTimerTasks

      public void cancelTimerTasks()
      cancel a timer task to trim timed out entries in the cache.
    • postProcessInvocationInfo

      protected com.sun.ejb.InvocationInfo postProcessInvocationInfo(com.sun.ejb.InvocationInfo invInfo)
      Overrides:
      postProcessInvocationInfo in class com.sun.ejb.containers.BaseContainer
    • initializeHome

      protected void initializeHome() throws Exception
      Called from the ContainerFactory during initialization.
      Overrides:
      initializeHome in class com.sun.ejb.containers.BaseContainer
      Throws:
      Exception
    • registerMonitorableComponents

      protected void registerMonitorableComponents()
      Overrides:
      registerMonitorableComponents in class com.sun.ejb.containers.BaseContainer
    • getMonitoringStatsProvider

      protected com.sun.ejb.monitoring.stats.EjbMonitoringStatsProvider getMonitoringStatsProvider(String appName, String modName, String ejbName)
      Specified by:
      getMonitoringStatsProvider in class com.sun.ejb.containers.BaseContainer
    • onReady

      public void onReady()
      Specified by:
      onReady in interface com.sun.ejb.Container
      Overrides:
      onReady in class com.sun.ejb.containers.BaseContainer
    • getMaxCacheSize

      public int getMaxCacheSize()
    • getSteadyPoolSize

      public int getSteadyPoolSize()
    • getMaxPoolSize

      public int getMaxPoolSize()
    • getPooledCount

      public long getPooledCount()
    • getReadyCount

      public long getReadyCount()
    • createEJBObjectImpl

      protected com.sun.ejb.containers.EJBObjectImpl createEJBObjectImpl() throws jakarta.ejb.CreateException, RemoteException
      Implementation of BaseContainer method. This is never called.
      Specified by:
      createEJBObjectImpl in class com.sun.ejb.containers.BaseContainer
      Throws:
      jakarta.ejb.CreateException
      RemoteException
    • createEJBLocalObjectImpl

      protected com.sun.ejb.containers.EJBLocalObjectImpl createEJBLocalObjectImpl() throws jakarta.ejb.CreateException
      Overrides:
      createEJBLocalObjectImpl in class com.sun.ejb.containers.BaseContainer
      Throws:
      jakarta.ejb.CreateException
    • getEJBObjectImpl

      protected com.sun.ejb.containers.EJBObjectImpl getEJBObjectImpl(byte[] streamKey)
      Called when a remote EjbInvocation arrives for an EJB.
      Specified by:
      getEJBObjectImpl in class com.sun.ejb.containers.BaseContainer
    • getEJBLocalObjectImpl

      protected com.sun.ejb.containers.EJBLocalObjectImpl getEJBLocalObjectImpl(Object key)
      Called from EJBLocalObjectImpl.getLocalObject() while deserializing a local object reference.
      Overrides:
      getEJBLocalObjectImpl in class com.sun.ejb.containers.BaseContainer
    • _getContext

      protected com.sun.ejb.ComponentContext _getContext(com.sun.ejb.EjbInvocation inv)
      Called from BaseContainer.preInvoke which is called from the EJBObject for local and remote invocations, and from the EJBHome for create/find.
      Specified by:
      _getContext in class com.sun.ejb.containers.BaseContainer
    • willInvokeWithClientTx

      protected boolean willInvokeWithClientTx(com.sun.ejb.EjbInvocation inv)
    • releaseContext

      public void releaseContext(com.sun.ejb.EjbInvocation inv)
      This is called from BaseContainer.postInvoke after EntityContainer.preInvokeTx has been called.
      Specified by:
      releaseContext in class com.sun.ejb.containers.BaseContainer
    • preCreate

      protected void preCreate(com.sun.ejb.EjbInvocation inv, EntityContextImpl context)
      Called from getContext before the ejb.ejbCreate is called
    • postCreate

      public void postCreate(com.sun.ejb.EjbInvocation inv, Object primaryKey) throws jakarta.ejb.CreateException
      This is called from the generated "HelloEJBHomeImpl" create* method, after ejb.ejbCreate() has been called and before ejb.ejbPostCreate() is called. Note: postCreate will not be called if ejbCreate throws an exception
      Specified by:
      postCreate in interface com.sun.ejb.Container
      Overrides:
      postCreate in class com.sun.ejb.containers.BaseContainer
      Throws:
      jakarta.ejb.CreateException
    • invokeFindByPrimaryKey

      protected Object invokeFindByPrimaryKey(Method method, com.sun.ejb.EjbInvocation inv, Object[] args) throws Throwable
      Overrides:
      invokeFindByPrimaryKey in class com.sun.ejb.containers.BaseContainer
      Throws:
      Throwable
    • authorizeLocalGetPrimaryKey

      protected void authorizeLocalGetPrimaryKey(com.sun.ejb.containers.EJBLocalRemoteObject ejbObj) throws jakarta.ejb.EJBException
      Overrides:
      authorizeLocalGetPrimaryKey in class com.sun.ejb.containers.BaseContainer
      Throws:
      jakarta.ejb.EJBException
    • authorizeRemoteGetPrimaryKey

      protected void authorizeRemoteGetPrimaryKey(com.sun.ejb.containers.EJBLocalRemoteObject ejbObj) throws RemoteException
      Overrides:
      authorizeRemoteGetPrimaryKey in class com.sun.ejb.containers.BaseContainer
      Throws:
      RemoteException
    • preFind

      protected void preFind(com.sun.ejb.EjbInvocation inv, EntityContextImpl context)
      Called from getContext before the ejb.ejbFind* is called
    • preSelect

      public void preSelect() throws jakarta.ejb.EJBException
      Called from CMP PersistentManager
      Specified by:
      preSelect in interface com.sun.ejb.Container
      Overrides:
      preSelect in class com.sun.ejb.containers.BaseContainer
      Throws:
      jakarta.ejb.EJBException
    • postFind

      public Object postFind(com.sun.ejb.EjbInvocation inv, Object primaryKeys, Object[] findParams) throws jakarta.ejb.FinderException
      Convert a collection of primary keys to a collection of EJBObjects. (special case: single primary key). Note: the order of input & output collections must be maintained. Null values are preserved in both the single primary key return and collection-valued return cases. This is called from the generated "HelloEJBHomeImpl" find* method, after ejb.ejbFind**() has been called. Note: postFind will not be called if ejbFindXXX throws an exception
      Specified by:
      postFind in interface com.sun.ejb.Container
      Overrides:
      postFind in class com.sun.ejb.containers.BaseContainer
      Throws:
      jakarta.ejb.FinderException
    • getEJBObjectForPrimaryKey

      public jakarta.ejb.EJBObject getEJBObjectForPrimaryKey(Object pkey)
      Called only from the Persistence Manager for EJB2.0 CMP EntityBeans. This is a private API between the PM and Container because there is no standard API defined in EJB2.0 for the PM to get an EJBObject for a primary key (home.findByPrimaryKey cant be used because it may not run in the same tx).
      Specified by:
      getEJBObjectForPrimaryKey in interface com.sun.ejb.Container
      Overrides:
      getEJBObjectForPrimaryKey in class com.sun.ejb.containers.BaseContainer
    • getEJBLocalObjectForPrimaryKey

      public jakarta.ejb.EJBLocalObject getEJBLocalObjectForPrimaryKey(Object pkey, jakarta.ejb.EJBContext ctx)
      Called only from the Persistence Manager for EJB2.0 CMP EntityBeans. Called only during cascade delete...... This is a private API between the PM and Container because there is no standard API defined in EJB2.0 for the PM to get an EJBLocalObject for a primary key (findByPrimaryKey cant be used because it may not run in the same tx). Example 1: A cascadeDeletes B and B calls getA() (expected return value: null) In the above case, getA() eventualy calls getEJBLocalObjectForPrimaryKey(PK_of_A, Ctx_of_B) We first check if B is in the process of being cascade deleted by checking the cascadeDeleteBeforeEJBRemove flag. If this flag is true, only then we bother to check if the Context associated with the PK_of_A in this transaction is marked for cascade delete which can be figured out by checking isCascadeDeleteAfterSuperEJBRemove() in A's context. If A is marked for cascade delete then we return null else the EJBLocalObject associated with A. Example 2: C cascadeDeletes B and B calls getA() (expected return value: EJBLocalObject for PK_of_A) In the above case, getA() eventualy calls getEJBLocalObjectForPrimaryKey(PK_of_A, Ctx_of_B) We first check if B is in the process of being cascade deleted by checking the cascadeDeleteBeforeEJBRemove flag. This flag will be true, and hence we check if the Context associated with the PK_of_A in this transaction is marked for cascade delete which can be figured out by checking isCascadeDeleteAfterSuperEJBRemove() in A's context. In this case this flag will be false and hcen we return the ejbLocalObject Example 2: B is *NOT* cascade deleted and B calls getA() (expected return value: EJBLocalObject for PK_of_A) In the above case, getA() eventualy calls getEJBLocalObjectForPrimaryKey(PK_of_A, Ctx_of_B) We first check if B is in the process of being cascade deleted by checking the cascadeDeleteBeforeEJBRemove flag. This flag will be FALSE, and hence we do not make any further check and return the EJBLocalObject associated with A
      Specified by:
      getEJBLocalObjectForPrimaryKey in interface com.sun.ejb.Container
      Overrides:
      getEJBLocalObjectForPrimaryKey in class com.sun.ejb.containers.BaseContainer
      Parameters:
      pkey - The primary key for which the EJBLocalObject is required
      ctx - The context associated with the bean from which the accessor method is invoked
      Returns:
      The EJBLocalObject associated with the PK or null if it is cascade deleted.
    • getEJBLocalObjectForPrimaryKey

      public jakarta.ejb.EJBLocalObject getEJBLocalObjectForPrimaryKey(Object pkey)
      Called only from the Persistence Manager for EJB2.0 CMP EntityBeans. This is a private API between the PM and Container because there is no standard API defined in EJB2.0 for the PM to get an EJBLocalObject for a primary key (findByPrimaryKey cant be used because it may not run in the same tx).
      Specified by:
      getEJBLocalObjectForPrimaryKey in interface com.sun.ejb.Container
      Overrides:
      getEJBLocalObjectForPrimaryKey in class com.sun.ejb.containers.BaseContainer
    • doEJBHomeRemove

      protected void doEJBHomeRemove(Object primaryKey, Method removeMethod, boolean local) throws jakarta.ejb.RemoveException, jakarta.ejb.EJBException, RemoteException
      Overrides:
      doEJBHomeRemove in class com.sun.ejb.containers.BaseContainer
      Throws:
      jakarta.ejb.RemoveException
      jakarta.ejb.EJBException
      RemoteException
    • removeBean

      protected void removeBean(com.sun.ejb.containers.EJBLocalRemoteObject ejbo, Method removeMethod, boolean local) throws jakarta.ejb.RemoveException, jakarta.ejb.EJBException, RemoteException
      Specified by:
      removeBean in class com.sun.ejb.containers.BaseContainer
      Throws:
      jakarta.ejb.RemoveException
      jakarta.ejb.EJBException
      RemoteException
    • removeBean

      protected void removeBean(com.sun.ejb.EjbInvocation inv) throws jakarta.ejb.RemoveException
      container.preInvoke() must already be done. So this will be called with the proper Tx context.
      Throws:
      jakarta.ejb.RemoveException - if an error occurs while removing the bean
    • removeBeanUnchecked

      public void removeBeanUnchecked(jakarta.ejb.EJBLocalObject localObj)
      Remove a bean. Used by the PersistenceManager. This is needed because the PM's remove must bypass tx/security checks.
      Specified by:
      removeBeanUnchecked in interface com.sun.ejb.Container
      Overrides:
      removeBeanUnchecked in class com.sun.ejb.containers.BaseContainer
    • removeBeanUnchecked

      public void removeBeanUnchecked(Object primaryKey)
      Remove a bean. Used by the PersistenceManager. This is needed because the PM's remove must bypass tx/security checks.
      Specified by:
      removeBeanUnchecked in interface com.sun.ejb.Container
      Overrides:
      removeBeanUnchecked in class com.sun.ejb.containers.BaseContainer
    • forceDestroyBean

      protected void forceDestroyBean(com.sun.ejb.containers.EJBContextImpl ctx)
      Discard the bean instance. The bean's persistent state is not removed. This is usually called when the bean instance throws a system exception, from BaseContainer.postInvokeTx, getReadyEJB, afterBegin, beforeCompletion, passivateEJB.
      Specified by:
      forceDestroyBean in class com.sun.ejb.containers.BaseContainer
    • checkUnfinishedTx

      protected void checkUnfinishedTx(jakarta.transaction.Transaction prevTx, com.sun.ejb.EjbInvocation inv)
      Overrides:
      checkUnfinishedTx in class com.sun.ejb.containers.BaseContainer
    • checkExists

      protected void checkExists(com.sun.ejb.containers.EJBLocalRemoteObject ejbObj)
      Check if the given EJBObject/LocalObject has been removed. Called before executing non-business methods of EJBLocalObject.
      Overrides:
      checkExists in class com.sun.ejb.containers.BaseContainer
      Throws:
      jakarta.ejb.NoSuchObjectLocalException - if the object has been removed.
    • afterBegin

      protected void afterBegin(com.sun.ejb.containers.EJBContextImpl ctx)
      Specified by:
      afterBegin in class com.sun.ejb.containers.BaseContainer
    • beforeCompletion

      protected void beforeCompletion(com.sun.ejb.containers.EJBContextImpl ctx)
      Specified by:
      beforeCompletion in class com.sun.ejb.containers.BaseContainer
    • afterCompletion

      protected void afterCompletion(com.sun.ejb.containers.EJBContextImpl ctx, int status)
      Specified by:
      afterCompletion in class com.sun.ejb.containers.BaseContainer
    • preInvokeNoTx

      protected void preInvokeNoTx(com.sun.ejb.EjbInvocation inv)
      Overrides:
      preInvokeNoTx in class com.sun.ejb.containers.BaseContainer
    • postInvokeNoTx

      protected void postInvokeNoTx(com.sun.ejb.EjbInvocation inv)
      Overrides:
      postInvokeNoTx in class com.sun.ejb.containers.BaseContainer
    • adjustInvocationInfo

      protected void adjustInvocationInfo(com.sun.ejb.InvocationInfo invInfo, Method method, int txAttr, boolean flushEnabled, String methodIntf, Class originalIntf) throws jakarta.ejb.EJBException
      Overrides:
      adjustInvocationInfo in class com.sun.ejb.containers.BaseContainer
      Throws:
      jakarta.ejb.EJBException
    • trimEvent

      public void trimEvent(Object primaryKey, Object context)
      Specified by:
      trimEvent in interface com.sun.appserv.util.cache.CacheListener
    • passivateEJB

      protected boolean passivateEJB(com.sun.ejb.ComponentContext ctx)
      Specified by:
      passivateEJB in class com.sun.ejb.containers.BaseContainer
    • internalGetEJBLocalObjectImpl

      protected com.sun.ejb.containers.EJBLocalObjectImpl internalGetEJBLocalObjectImpl(Object primaryKey)
      The following are private methods for implementing internal logic for lifecyle and state management, in a reusable way.
    • internalGetEJBLocalObjectImpl

      protected com.sun.ejb.containers.EJBLocalObjectImpl internalGetEJBLocalObjectImpl(Object primaryKey, boolean incrementRefCount)
    • internalGetEJBLocalObjectImpl

      protected com.sun.ejb.containers.EJBLocalObjectImpl internalGetEJBLocalObjectImpl(Object primaryKey, boolean incrementRefCount, boolean cacheEJBO)
    • getPooledEJB

      protected EntityContextImpl getPooledEJB()
    • addPooledEJB

      protected void addPooledEJB(EntityContextImpl context)
    • passivateAndPoolEJB

      protected void passivateAndPoolEJB(EntityContextImpl context)
    • activateEJBFromPool

      protected EntityContextImpl activateEJBFromPool(Object primaryKey, com.sun.ejb.EjbInvocation inv)
      Called from getContext and getEJBWithIncompleteTx Get an EJB in the ready state (i.e. which is not doing any invocations and doesnt have any incomplete Tx), for the ejbObject provided in the EjbInvocation. Concurrent invocations should get *different* instances.
    • removeIncompleteTxEJB

      protected void removeIncompleteTxEJB(EntityContextImpl context, boolean updateTxBeanTable)
      Called from releaseContext if ejb is removed, from afterCompletion, and from passivateEJB.
    • isIdentical

      protected boolean isIdentical(com.sun.ejb.containers.EJBObjectImpl ejbObjImpl, jakarta.ejb.EJBObject other) throws RemoteException
      Overrides:
      isIdentical in class com.sun.ejb.containers.BaseContainer
      Throws:
      RemoteException
    • callEJBLoad

      protected void callEJBLoad(jakarta.ejb.EntityBean ejb, EntityContextImpl context, boolean activeTx) throws Exception
      Throws:
      Exception
    • callEJBStore

      protected void callEJBStore(jakarta.ejb.EntityBean ejb, EntityContextImpl context) throws Exception
      Throws:
      Exception
    • callEJBRemove

      protected void callEJBRemove(jakarta.ejb.EntityBean ejb, EntityContextImpl context) throws Exception
      Throws:
      Exception
    • doTimerInvocationInit

      protected void doTimerInvocationInit(com.sun.ejb.EjbInvocation inv, Object primaryKey) throws Exception
      Overrides:
      doTimerInvocationInit in class com.sun.ejb.containers.BaseContainer
      Throws:
      Exception
    • doConcreteContainerShutdown

      protected void doConcreteContainerShutdown(boolean appBeingUndeployed)
      Specified by:
      doConcreteContainerShutdown in class com.sun.ejb.containers.BaseContainer
    • afterNewlyActivated

      protected void afterNewlyActivated(EntityContextImpl context)
    • createEntityContextInstance

      protected EntityContextImpl createEntityContextInstance(jakarta.ejb.EntityBean ejb, EntityContainer entityContainer)
    • createReadyStore

      protected void createReadyStore(int cacheSize, int numberOfVictimsToSelect, float loadFactor, long idleTimeout) throws Exception
      Throws:
      Exception
    • createEJBObjectStores

      protected void createEJBObjectStores(int cacheSize, int numberOfVictimsToSelect, long idleTimeout) throws Exception
      Throws:
      Exception
    • getReadyEJB

      protected EntityContextImpl getReadyEJB(com.sun.ejb.EjbInvocation inv)
    • addReadyEJB

      protected void addReadyEJB(EntityContextImpl context)
    • destroyReadyStoreOnUndeploy

      protected void destroyReadyStoreOnUndeploy()
    • removeContextFromReadyStore

      protected void removeContextFromReadyStore(Object primaryKey, EntityContextImpl context)
    • addProxyInterfacesSetClass

      protected void addProxyInterfacesSetClass(Set proxyInterfacesSet, boolean local)
      Overrides:
      addProxyInterfacesSetClass in class com.sun.ejb.containers.BaseContainer
    • doFlush

      protected void doFlush(com.sun.ejb.EjbInvocation inv)
      Overrides:
      doFlush in class com.sun.ejb.containers.BaseContainer