com.sun.ejb.containers
Class ReadOnlyBeanContainer

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

public class ReadOnlyBeanContainer
extends EntityContainer
implements ReadOnlyBeanRefreshEventHandler

The Container that manages instances of ReadOnly Beans. This container blocks all calls to ejbStore() and selectively performs ejbLoad()

Author:
Mahesh Kannan, Pramod Gopinath

Nested Class Summary
 
Nested classes/interfaces inherited from class com.sun.ejb.containers.EntityContainer
EntityContainer.CacheProperties, EntityContainer.EJBObjectCacheVictimHandler, EntityContainer.LocalEJBObjectCacheVictimHandler
 
Nested classes/interfaces inherited from class com.sun.ejb.containers.BaseContainer
BaseContainer.ContainerType
 
Field Summary
 
Fields inherited from class com.sun.ejb.containers.EntityContainer
_maxBuckets, beanCacheDes, beanPoolDes, DEFAULT_CACHE_SIZE, DEFAULT_LOAD_FACTOR, defaultCacheEJBO, ejbContainer, ejbLocalObjectStore, ejbObjectStore, ejboRemoved, entityCtxPool, HIGH_WATER_MARK, iased, idleEJBObjectPassivator, idleLocalEJBObjectPassivator, isContainerManagedPers, isReentrant, localStrings, passivationCandidates, readyStore, totalPassivationErrors, 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 ReadOnlyBeanContainer(EjbDescriptor desc, ClassLoader loader)
           
 
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  void addPooledEJB(EntityContextImpl ctx)
           
protected  void afterNewlyActivated(EntityContextImpl context)
           
protected  void callEJBLoad(EntityBean ejb, EntityContextImpl entityCtx, boolean activeTx)
           
protected  void callEJBRemove(EntityBean ejb, EntityContextImpl context)
           
protected  void callEJBStore(EntityBean ejb, EntityContextImpl context)
           
protected  EntityContextImpl createEntityContextInstance(EntityBean ejb, EntityContainer entityContainer)
           
protected  void doConcreteContainerShutdown(boolean appBeingUndeployed)
           
protected  void forceDestroyBean(EJBContextImpl context)
          Discard the bean instance.
 void handleRefreshAllRequest()
          Called from DistributedReadOnlyBeanServiceImpl when a refreshAll message arrives at this instance
 void handleRefreshRequest(Object primaryKey)
          Called from DistributedReadOnlyBeanServiceImpl when a refresh message arrives at this instance
protected  void initializeHome()
          Called from the ContainerFactory during initialization.
protected  Object invokeFindByPrimaryKey(Method method, EjbInvocation inv, Object[] args)
           
 Object postFind(EjbInvocation inv, Object primaryKeys, Object[] findParams)
          Convert a collection of primary keys to a collection of EJBObjects.
 void preInvoke(EjbInvocation inv)
          Called from EJBObject/EJBHome before invoking on EJB.
protected  void removeBean(EJBLocalRemoteObject ejbo, Method removeMethod, boolean local)
           
 void setRefreshFlag(Object primaryKey)
           
 
Methods inherited from class com.sun.ejb.containers.EntityContainer
activateEJBFromPool, addReadyEJB, cancelTimerTasks, checkUnfinishedTx, createEJBObjectStores, createReadyStore, destroyReadyStoreOnUndeploy, doEJBHomeRemove, doFlush, getEJBLocalObjectForPrimaryKey, getEJBLocalObjectForPrimaryKey, getEJBObjectForPrimaryKey, getMaxCacheSize, getMaxPoolSize, getMonitoringStatsProvider, getPooledCount, getPooledEJB, getReadyCount, getReadyEJB, getSteadyPoolSize, internalGetEJBLocalObjectImpl, internalGetEJBLocalObjectImpl, internalGetEJBLocalObjectImpl, internalGetEJBObjectImpl, internalGetEJBObjectImpl, internalGetEJBObjectImpl, onReady, passivateAndPoolEJB, postCreate, postProcessInvocationInfo, preCreate, preFind, preInitialize, preSelect, registerMonitorableComponents, releaseContext, removeBean, removeBeanUnchecked, removeBeanUnchecked, removeContextFromReadyStore, removeIncompleteTxEJB, setupIdleBeansPassivator, trimEvent, willInvokeWithClientTx
 
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, 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
 
Methods inherited from interface com.sun.ejb.spi.distributed.ReadOnlyBeanRefreshEventHandler
getClassLoader
 

Constructor Detail

ReadOnlyBeanContainer

protected ReadOnlyBeanContainer(EjbDescriptor desc,
                                ClassLoader loader)
                         throws Exception
Throws:
Exception
Method Detail

callEJBStore

protected void callEJBStore(EntityBean ejb,
                            EntityContextImpl context)
Overrides:
callEJBStore in class EntityContainer

_getContext

protected ComponentContext _getContext(EjbInvocation inv)
Description copied from class: EntityContainer
Called from BaseContainer.preInvoke which is called from the EJBObject for local and remote invocations, and from the EJBHome for create/find.

Overrides:
_getContext in class EntityContainer

callEJBLoad

protected void callEJBLoad(EntityBean ejb,
                           EntityContextImpl entityCtx,
                           boolean activeTx)
                    throws Exception
Overrides:
callEJBLoad in class EntityContainer
Throws:
Exception

callEJBRemove

protected void callEJBRemove(EntityBean ejb,
                             EntityContextImpl context)
                      throws Exception
Overrides:
callEJBRemove in class EntityContainer
Throws:
Exception

doConcreteContainerShutdown

protected void doConcreteContainerShutdown(boolean appBeingUndeployed)
Overrides:
doConcreteContainerShutdown in class EntityContainer

afterNewlyActivated

protected void afterNewlyActivated(EntityContextImpl context)
Overrides:
afterNewlyActivated in class EntityContainer

addPooledEJB

protected void addPooledEJB(EntityContextImpl ctx)
Overrides:
addPooledEJB in class EntityContainer

forceDestroyBean

protected void forceDestroyBean(EJBContextImpl context)
Description copied from class: EntityContainer
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.


preInvoke

public void preInvoke(EjbInvocation inv)
Description copied from class: BaseContainer
Called from EJBObject/EJBHome before invoking on EJB. Set the EJB instance in the EjbInvocation. It must be ensured that the following general pattern is followed by various parts of the EJBContainer code: try { container.preInvoke(inv); returnValue = container.intercept(inv); } catch (Exception1 e1) { ... } catch (Exception2 e2) { ... } finally { container.postInvoke(); }

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

removeBean

protected void removeBean(EJBLocalRemoteObject ejbo,
                          Method removeMethod,
                          boolean local)
                   throws RemoveException,
                          EJBException,
                          RemoteException
Overrides:
removeBean in class EntityContainer
Throws:
RemoveException
EJBException
RemoteException

initializeHome

protected void initializeHome()
                       throws Exception
Description copied from class: EntityContainer
Called from the ContainerFactory during initialization.

Overrides:
initializeHome in class EntityContainer
Throws:
Exception

setRefreshFlag

public void setRefreshFlag(Object primaryKey)

handleRefreshRequest

public void handleRefreshRequest(Object primaryKey)
Description copied from interface: ReadOnlyBeanRefreshEventHandler
Called from DistributedReadOnlyBeanServiceImpl when a refresh message arrives at this instance

Specified by:
handleRefreshRequest in interface ReadOnlyBeanRefreshEventHandler
Parameters:
primaryKey - the primary key that needs to be refreshed

handleRefreshAllRequest

public void handleRefreshAllRequest()
Description copied from interface: ReadOnlyBeanRefreshEventHandler
Called from DistributedReadOnlyBeanServiceImpl when a refreshAll message arrives at this instance

Specified by:
handleRefreshAllRequest in interface ReadOnlyBeanRefreshEventHandler

createEntityContextInstance

protected EntityContextImpl createEntityContextInstance(EntityBean ejb,
                                                        EntityContainer entityContainer)
Overrides:
createEntityContextInstance in class EntityContainer

invokeFindByPrimaryKey

protected Object invokeFindByPrimaryKey(Method method,
                                        EjbInvocation inv,
                                        Object[] args)
                                 throws Throwable
Overrides:
invokeFindByPrimaryKey in class EntityContainer
Throws:
Throwable

postFind

public Object postFind(EjbInvocation inv,
                       Object primaryKeys,
                       Object[] findParams)
                throws FinderException
Description copied from class: EntityContainer
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 EntityContainer
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


Copyright © 2012 GlassFish Community. All Rights Reserved.