com.sun.ejb.containers
Class EntityContainer

java.lang.Object
  extended by com.sun.ejb.containers.BaseContainer
      extended by com.sun.ejb.containers.EntityContainer
All Implemented Interfaces:
CacheListener, Container, JavaEEContainer, EjbContainerFacade
Direct Known Subclasses:
CommitCEntityContainer, ReadOnlyBeanContainer

public class EntityContainer
extends BaseContainer
implements 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):

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
protected  class EntityContainer.CacheProperties
           
protected  class EntityContainer.EJBObjectCacheVictimHandler
           
protected  class EntityContainer.LocalEJBObjectCacheVictimHandler
           
 
Nested classes/interfaces inherited from class com.sun.ejb.containers.BaseContainer
BaseContainer.ContainerType
 
Field Summary
protected  int _maxBuckets
           
protected  BeanCacheDescriptor beanCacheDes
           
protected  BeanPoolDescriptor beanPoolDes
           
protected  int DEFAULT_CACHE_SIZE
           
protected  float DEFAULT_LOAD_FACTOR
           
protected  boolean defaultCacheEJBO
           
protected  EjbContainer ejbContainer
           
protected  EJBObjectCache ejbLocalObjectStore
           
protected  EJBObjectCache ejbObjectStore
           
protected  int ejboRemoved
           
protected  AbstractPool entityCtxPool
           
protected static int HIGH_WATER_MARK
           
protected  IASEjbExtraDescriptors iased
           
protected  com.sun.ejb.containers.EntityContainer.IdleBeansPassivator idleEJBObjectPassivator
           
protected  com.sun.ejb.containers.EntityContainer.IdleBeansPassivator idleLocalEJBObjectPassivator
           
protected  boolean isContainerManagedPers
           
protected  boolean isReentrant
           
protected static LocalStringManagerImpl localStrings
           
protected  java.util.Stack passivationCandidates
           
protected  Cache readyStore
           
protected  int totalPassivationErrors
           
protected  int totalPassivations
           
 
Fields inherited from class com.sun.ejb.containers.BaseContainer
_logger, cacheProbeListener, cacheProbeNotifier, callFlowInfo, cmtTimeoutInSeconds, componentId, CONTAINER_INITIALIZING, CONTAINER_ON_HOLD, CONTAINER_STARTED, CONTAINER_STOPPED, CONTAINER_UNDEPLOYED, containerInfo, containerState, containerType, debugMonitorFlag, ejbActivateMethod, ejbClass, ejbContainerUtilImpl, ejbDescriptor, ejbGeneratedOptionalLocalBusinessIntfClass, ejbHome, ejbHomeImpl, ejbHomeStub, ejbIntfMethodInfo, ejbIntfMethods, ejbLocalBusinessHome, ejbLocalBusinessHomeImpl, ejbLocalHome, ejbLocalHomeImpl, ejbMethodStatsManager, ejbOptionalLocalBusinessHome, ejbOptionalLocalBusinessHomeImpl, ejbOptionalLocalBusinessHomeIntf, ejbPassivateMethod, ejbProbeListener, ejbProbeNotifier, ejbRemoteBusinessHome, ejbRemoteBusinessHomeImpl, ejbRemoteBusinessHomeStub, ejbRemoveMethod, ejbTimeoutMethod, envProps, hasLocalBusinessView, hasLocalHomeView, hasOptionalLocalBusinessView, hasRemoteBusinessView, hasRemoteHomeView, homeIntf, injectionManager, interceptorManager, invocationInfoMap, invocationManager, isEntity, isLocal, isMessageDriven, isRemote, isSession, isSingleton, isStatefulSession, isStatelessSession, isWebServiceEndpoint, lifecycleCallbackAnnotationClasses, loader, localBusinessHomeIntf, localBusinessIntfs, localHomeIntf, logParams, metadata, methodMonitorMap, monitorOn, namingManager, NO_PARAMS, optIntfClassLoader, poolProbeListener, registryMediator, 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
protected EntityContainer(BaseContainer.ContainerType containerType, EjbDescriptor desc, java.lang.ClassLoader loader)
           
protected EntityContainer(EjbDescriptor desc, java.lang.ClassLoader loader)
          This constructor is called from the JarManager when a Jar is deployed.
 
Method Summary
protected  ComponentContext _getContext(EjbInvocation inv)
          Called from BaseContainer.preInvoke which is called from the EJBObject for local and remote invocations, and from the EJBHome for create/find.
protected  EntityContextImpl activateEJBFromPool(java.lang.Object primaryKey, EjbInvocation inv)
          Called from getContext and getEJBWithIncompleteTx Get an EJB in the ready state (i.e.
protected  void addPooledEJB(EntityContextImpl context)
           
protected  void addReadyEJB(EntityContextImpl context)
           
protected  void afterNewlyActivated(EntityContextImpl context)
           
protected  void callEJBLoad(EntityBean ejb, EntityContextImpl context, boolean activeTx)
           
protected  void callEJBRemove(EntityBean ejb, EntityContextImpl context)
           
protected  void callEJBStore(EntityBean ejb, EntityContextImpl context)
           
 void cancelTimerTasks()
          cancel a timer task to trim timed out entries in the cache.
protected  void checkUnfinishedTx(Transaction prevTx, EjbInvocation inv)
           
protected  void createEJBObjectStores(int cacheSize, int numberOfVictimsToSelect, long idleTimeout)
           
protected  EntityContextImpl createEntityContextInstance(EntityBean ejb, EntityContainer entityContainer)
           
protected  void createReadyStore(int cacheSize, int numberOfVictimsToSelect, float loadFactor, long idleTimeout)
           
protected  void destroyReadyStoreOnUndeploy()
           
protected  void doConcreteContainerShutdown(boolean appBeingUndeployed)
           
protected  void doEJBHomeRemove(java.lang.Object primaryKey, java.lang.reflect.Method removeMethod, boolean local)
           
protected  void doFlush(EjbInvocation inv)
           
 EJBLocalObject getEJBLocalObjectForPrimaryKey(java.lang.Object pkey)
          Called only from the Persistence Manager for EJB2.0 CMP EntityBeans.
 EJBLocalObject getEJBLocalObjectForPrimaryKey(java.lang.Object pkey, EJBContext ctx)
          Called only from the Persistence Manager for EJB2.0 CMP EntityBeans.
 EJBObject getEJBObjectForPrimaryKey(java.lang.Object pkey)
          Called only from the Persistence Manager for EJB2.0 CMP EntityBeans.
 int getMaxCacheSize()
           
 int getMaxPoolSize()
           
protected  EjbMonitoringStatsProvider getMonitoringStatsProvider(java.lang.String appName, java.lang.String modName, java.lang.String ejbName)
           
 long getPooledCount()
           
protected  EntityContextImpl getPooledEJB()
           
 long getReadyCount()
           
protected  EntityContextImpl getReadyEJB(EjbInvocation inv)
           
 int getSteadyPoolSize()
           
protected  void initializeHome()
          Called from the ContainerFactory during initialization.
protected  EJBLocalObjectImpl internalGetEJBLocalObjectImpl(java.lang.Object primaryKey)
          The following are private methods for implementing internal logic for lifecyle and state management, in a reusable way.
protected  EJBLocalObjectImpl internalGetEJBLocalObjectImpl(java.lang.Object primaryKey, boolean incrementRefCount)
           
protected  EJBLocalObjectImpl internalGetEJBLocalObjectImpl(java.lang.Object primaryKey, boolean incrementRefCount, boolean cacheEJBO)
           
protected  EJBObjectImpl internalGetEJBObjectImpl(java.lang.Object primaryKey, byte[] streamKey)
           
protected  EJBObjectImpl internalGetEJBObjectImpl(java.lang.Object primaryKey, byte[] streamKey, boolean incrementRefCount)
           
protected  EJBObjectImpl internalGetEJBObjectImpl(java.lang.Object primaryKey, byte[] streamKey, boolean incrementRefCount, boolean cacheEJBO)
           
protected  java.lang.Object invokeFindByPrimaryKey(java.lang.reflect.Method method, EjbInvocation inv, java.lang.Object[] args)
           
 void onReady()
          Called when server instance is Ready
protected  void passivateAndPoolEJB(EntityContextImpl context)
           
 void postCreate(EjbInvocation inv, java.lang.Object primaryKey)
          This is called from the generated "HelloEJBHomeImpl" create* method, after ejb.ejbCreate() has been called and before ejb.ejbPostCreate() is called.
 java.lang.Object postFind(EjbInvocation inv, java.lang.Object primaryKeys, java.lang.Object[] findParams)
          Convert a collection of primary keys to a collection of EJBObjects.
protected  InvocationInfo postProcessInvocationInfo(InvocationInfo invInfo)
           
protected  void preCreate(EjbInvocation inv, EntityContextImpl context)
          Called from getContext before the ejb.ejbCreate is called
protected  void preFind(EjbInvocation inv, EntityContextImpl context)
          Called from getContext before the ejb.ejbFind* is called
protected  void preInitialize(EjbDescriptor desc, java.lang.ClassLoader loader)
           
 void preSelect()
          Called from CMP PersistentManager
protected  void registerMonitorableComponents()
           
 void releaseContext(EjbInvocation inv)
          This is called from BaseContainer.postInvoke after EntityContainer.preInvokeTx has been called.
protected  void removeBean(EjbInvocation inv)
          container.preInvoke() must already be done.
protected  void removeBean(EJBLocalRemoteObject ejbo, java.lang.reflect.Method removeMethod, boolean local)
           
 void removeBeanUnchecked(EJBLocalObject localObj)
          Remove a bean.
 void removeBeanUnchecked(java.lang.Object primaryKey)
          Remove a bean.
protected  void removeContextFromReadyStore(java.lang.Object primaryKey, EntityContextImpl context)
           
protected  void removeIncompleteTxEJB(EntityContextImpl context, boolean updateTxBeanTable)
          Called from releaseContext if ejb is removed, from afterCompletion, and from passivateEJB.
 com.sun.ejb.containers.EntityContainer.IdleBeansPassivator setupIdleBeansPassivator(Cache cache)
          setup a timer task to trim timed out entries in the cache.
 void trimEvent(java.lang.Object primaryKey, java.lang.Object context)
           
protected  boolean willInvokeWithClientTx(EjbInvocation inv)
           
 
Methods inherited from class com.sun.ejb.containers.BaseContainer
_constructEJBContextImpl, _constructEJBInstance, addSchedule, assertValidLocalObject, assertValidRemoteObject, authorize, checkExceptionClientTx, checkUserTransactionLookup, cleanupInstance, containerStateToString, createCallFlowAgent, createEjbInstanceAndContext, createMonitoringRegistryMediator, createRemoteReferenceWithId, doAfterBegin, enlistExtendedEntityManagers, externalPostInvoke, externalPreInvoke, findFlushEnabledAttr, findTxAttr, getClassLoader, getComponentId, getContainerClassLoader, getContainerType, getContext, getDebugMonitorFlag, getDescriptor, getEJBClass, getEjbDescriptor, getEJBHome, getEJBHomeStub, getEJBLocalBusinessHome, getEJBLocalHome, getEJBMetaData, getJaccEjb, getJavaGlobalJndiNamePrefix, getMonitoringMethodsArray, getMonitoringMethodsArray, getPre30LifecycleMethodNames, getProtocolManager, getSecurityManager, getTargetObject, getTxAttr, getTxAttr, incrementCreatedTimedObject, incrementDeliveredTimedObject, incrementRemovedTimedObject, injectEjbInstance, instantiateEJBLocalBusinessObjectImpl, instantiateEJBLocalObjectImpl, instantiateEJBObjectImpl, instantiateOptionalEJBLocalBusinessObjectImpl, instantiateRemoteBusinessObjectImpl, invokeBeanMethod, isAppExceptionRequiringRollback, isApplicationException, isHAEnabled, isLocalInterfaceSupported, isRemoteInterfaceSupported, isStopped, isSystemUncheckedException, isTimedObject, isUndeployed, lookupExtendedEntityManager, onShutdown, onTermination, populateMethodMonitorMap, populateMethodMonitorMap, populateMethodMonitorMap, postInvoke, postInvoke, postInvokeTx, preInvoke, preInvokeTx, registerTimerMonitorableComponent, registerTxAttrForMethod, releaseTargetObject, setDebugMonitorFlag, setMonitorOn, setSecurityManager, setStartedState, setStoppedState, setUndeployedState, startApplication, toString, undeploy, useClientTx, userTransactionMethodsAllowed, webServicePostInvoke
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

localStrings

protected static final LocalStringManagerImpl localStrings

HIGH_WATER_MARK

protected static final int HIGH_WATER_MARK
See Also:
Constant Field Values

ejbObjectStore

protected EJBObjectCache ejbObjectStore

ejbLocalObjectStore

protected EJBObjectCache ejbLocalObjectStore

passivationCandidates

protected java.util.Stack passivationCandidates

readyStore

protected Cache readyStore

entityCtxPool

protected AbstractPool entityCtxPool

isReentrant

protected boolean isReentrant

isContainerManagedPers

protected boolean isContainerManagedPers

DEFAULT_LOAD_FACTOR

protected final float DEFAULT_LOAD_FACTOR
See Also:
Constant Field Values

DEFAULT_CACHE_SIZE

protected final int DEFAULT_CACHE_SIZE
See Also:
Constant Field Values

_maxBuckets

protected int _maxBuckets

iased

protected IASEjbExtraDescriptors iased

beanCacheDes

protected BeanCacheDescriptor beanCacheDes

beanPoolDes

protected BeanPoolDescriptor beanPoolDes

ejbContainer

protected EjbContainer ejbContainer

idleEJBObjectPassivator

protected com.sun.ejb.containers.EntityContainer.IdleBeansPassivator idleEJBObjectPassivator

idleLocalEJBObjectPassivator

protected com.sun.ejb.containers.EntityContainer.IdleBeansPassivator idleLocalEJBObjectPassivator

defaultCacheEJBO

protected boolean defaultCacheEJBO

ejboRemoved

protected int ejboRemoved

totalPassivations

protected int totalPassivations

totalPassivationErrors

protected int totalPassivationErrors
Constructor Detail

EntityContainer

protected EntityContainer(EjbDescriptor desc,
                          java.lang.ClassLoader loader)
                   throws java.lang.Exception
This constructor is called from the JarManager when a Jar is deployed.

Throws:
java.lang.Exception - on error

EntityContainer

protected EntityContainer(BaseContainer.ContainerType containerType,
                          EjbDescriptor desc,
                          java.lang.ClassLoader loader)
                   throws java.lang.Exception
Throws:
java.lang.Exception
Method Detail

preInitialize

protected void preInitialize(EjbDescriptor desc,
                             java.lang.ClassLoader loader)
Overrides:
preInitialize in class BaseContainer

setupIdleBeansPassivator

public com.sun.ejb.containers.EntityContainer.IdleBeansPassivator setupIdleBeansPassivator(Cache cache)
                                                                                    throws java.lang.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:
java.lang.Exception

cancelTimerTasks

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


postProcessInvocationInfo

protected InvocationInfo postProcessInvocationInfo(InvocationInfo invInfo)
Overrides:
postProcessInvocationInfo in class BaseContainer

initializeHome

protected void initializeHome()
                       throws java.lang.Exception
Called from the ContainerFactory during initialization.

Throws:
java.lang.Exception

registerMonitorableComponents

protected void registerMonitorableComponents()
Overrides:
registerMonitorableComponents in class BaseContainer

getMonitoringStatsProvider

protected EjbMonitoringStatsProvider getMonitoringStatsProvider(java.lang.String appName,
                                                                java.lang.String modName,
                                                                java.lang.String ejbName)
Specified by:
getMonitoringStatsProvider in class BaseContainer

onReady

public void onReady()
Description copied from class: BaseContainer
Called when server instance is Ready

Specified by:
onReady in interface Container
Overrides:
onReady in class BaseContainer

getMaxCacheSize

public int getMaxCacheSize()

getSteadyPoolSize

public int getSteadyPoolSize()

getMaxPoolSize

public int getMaxPoolSize()

getPooledCount

public long getPooledCount()

getReadyCount

public long getReadyCount()

_getContext

protected ComponentContext _getContext(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 BaseContainer

willInvokeWithClientTx

protected boolean willInvokeWithClientTx(EjbInvocation inv)

releaseContext

public void releaseContext(EjbInvocation inv)
This is called from BaseContainer.postInvoke after EntityContainer.preInvokeTx has been called.

Specified by:
releaseContext in class BaseContainer

preCreate

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


postCreate

public void postCreate(EjbInvocation inv,
                       java.lang.Object primaryKey)
                throws 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 Container
Overrides:
postCreate in class BaseContainer
primaryKey - the value returned from ejbCreate.
Throws:
CreateException

invokeFindByPrimaryKey

protected java.lang.Object invokeFindByPrimaryKey(java.lang.reflect.Method method,
                                                  EjbInvocation inv,
                                                  java.lang.Object[] args)
                                           throws java.lang.Throwable
Throws:
java.lang.Throwable

preFind

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


preSelect

public void preSelect()
               throws EJBException
Called from CMP PersistentManager

Specified by:
preSelect in interface Container
Overrides:
preSelect in class BaseContainer
Throws:
EJBException - Thrown if an error occurs during the preSelect actions performed by the container. If thrown, the remaining select query steps should be aborted and an EJBException should be propagated back to the application code.

postFind

public java.lang.Object postFind(EjbInvocation inv,
                                 java.lang.Object primaryKeys,
                                 java.lang.Object[] findParams)
                          throws 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 Container
Overrides:
postFind in class BaseContainer
primaryKeys - the primaryKey or collection of primaryKeys (Collection/Enumeration) returned from ejbFind.
findParams - the parameters to the ejbFind method.
Returns:
an EJBObject reference or Collection/Enumeration of EJBObjects.
Throws:
FinderException

getEJBObjectForPrimaryKey

public EJBObject getEJBObjectForPrimaryKey(java.lang.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 Container
Overrides:
getEJBObjectForPrimaryKey in class BaseContainer

getEJBLocalObjectForPrimaryKey

public EJBLocalObject getEJBLocalObjectForPrimaryKey(java.lang.Object pkey,
                                                     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 Container
Overrides:
getEJBLocalObjectForPrimaryKey in class 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 EJBLocalObject getEJBLocalObjectForPrimaryKey(java.lang.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 Container
Overrides:
getEJBLocalObjectForPrimaryKey in class BaseContainer

doEJBHomeRemove

protected void doEJBHomeRemove(java.lang.Object primaryKey,
                               java.lang.reflect.Method removeMethod,
                               boolean local)
                        throws RemoveException,
                               EJBException,
                               java.rmi.RemoteException
Overrides:
doEJBHomeRemove in class BaseContainer
Throws:
RemoveException
EJBException
java.rmi.RemoteException

removeBean

protected void removeBean(EJBLocalRemoteObject ejbo,
                          java.lang.reflect.Method removeMethod,
                          boolean local)
                   throws RemoveException,
                          EJBException,
                          java.rmi.RemoteException
Throws:
RemoveException
EJBException
java.rmi.RemoteException

removeBean

protected void removeBean(EjbInvocation inv)
                   throws RemoveException
container.preInvoke() must already be done. So this will be called with the proper Tx context.

Throws:
RemoveException - if an error occurs while removing the bean

removeBeanUnchecked

public void removeBeanUnchecked(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 Container
Overrides:
removeBeanUnchecked in class BaseContainer

removeBeanUnchecked

public void removeBeanUnchecked(java.lang.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 Container
Overrides:
removeBeanUnchecked in class BaseContainer

checkUnfinishedTx

protected void checkUnfinishedTx(Transaction prevTx,
                                 EjbInvocation inv)
Overrides:
checkUnfinishedTx in class BaseContainer

trimEvent

public void trimEvent(java.lang.Object primaryKey,
                      java.lang.Object context)
Specified by:
trimEvent in interface CacheListener

internalGetEJBLocalObjectImpl

protected EJBLocalObjectImpl internalGetEJBLocalObjectImpl(java.lang.Object primaryKey)
The following are private methods for implementing internal logic for lifecyle and state management, in a reusable way.


internalGetEJBLocalObjectImpl

protected EJBLocalObjectImpl internalGetEJBLocalObjectImpl(java.lang.Object primaryKey,
                                                           boolean incrementRefCount)

internalGetEJBLocalObjectImpl

protected EJBLocalObjectImpl internalGetEJBLocalObjectImpl(java.lang.Object primaryKey,
                                                           boolean incrementRefCount,
                                                           boolean cacheEJBO)

internalGetEJBObjectImpl

protected EJBObjectImpl internalGetEJBObjectImpl(java.lang.Object primaryKey,
                                                 byte[] streamKey)

internalGetEJBObjectImpl

protected EJBObjectImpl internalGetEJBObjectImpl(java.lang.Object primaryKey,
                                                 byte[] streamKey,
                                                 boolean incrementRefCount)

internalGetEJBObjectImpl

protected EJBObjectImpl internalGetEJBObjectImpl(java.lang.Object primaryKey,
                                                 byte[] streamKey,
                                                 boolean incrementRefCount,
                                                 boolean cacheEJBO)

getPooledEJB

protected EntityContextImpl getPooledEJB()

addPooledEJB

protected void addPooledEJB(EntityContextImpl context)

passivateAndPoolEJB

protected void passivateAndPoolEJB(EntityContextImpl context)

activateEJBFromPool

protected EntityContextImpl activateEJBFromPool(java.lang.Object primaryKey,
                                                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.


callEJBLoad

protected void callEJBLoad(EntityBean ejb,
                           EntityContextImpl context,
                           boolean activeTx)
                    throws java.lang.Exception
Throws:
java.lang.Exception

callEJBStore

protected void callEJBStore(EntityBean ejb,
                            EntityContextImpl context)
                     throws java.lang.Exception
Throws:
java.lang.Exception

callEJBRemove

protected void callEJBRemove(EntityBean ejb,
                             EntityContextImpl context)
                      throws java.lang.Exception
Throws:
java.lang.Exception

doConcreteContainerShutdown

protected void doConcreteContainerShutdown(boolean appBeingUndeployed)
Specified by:
doConcreteContainerShutdown in class BaseContainer

afterNewlyActivated

protected void afterNewlyActivated(EntityContextImpl context)

createEntityContextInstance

protected EntityContextImpl createEntityContextInstance(EntityBean ejb,
                                                        EntityContainer entityContainer)

createReadyStore

protected void createReadyStore(int cacheSize,
                                int numberOfVictimsToSelect,
                                float loadFactor,
                                long idleTimeout)
                         throws java.lang.Exception
Throws:
java.lang.Exception

createEJBObjectStores

protected void createEJBObjectStores(int cacheSize,
                                     int numberOfVictimsToSelect,
                                     long idleTimeout)
                              throws java.lang.Exception
Throws:
java.lang.Exception

getReadyEJB

protected EntityContextImpl getReadyEJB(EjbInvocation inv)

addReadyEJB

protected void addReadyEJB(EntityContextImpl context)

destroyReadyStoreOnUndeploy

protected void destroyReadyStoreOnUndeploy()

removeContextFromReadyStore

protected void removeContextFromReadyStore(java.lang.Object primaryKey,
                                           EntityContextImpl context)

doFlush

protected void doFlush(EjbInvocation inv)
Overrides:
doFlush in class BaseContainer


Copyright © 2012 GlassFish Community. All Rights Reserved.