Class BaseContainer

java.lang.Object
com.sun.ejb.containers.BaseContainer
All Implemented Interfaces:
Container, com.sun.enterprise.container.common.spi.JavaEEContainer, org.glassfish.enterprise.iiop.spi.EjbContainerFacade
Direct Known Subclasses:
AbstractSingletonContainer, StatefulSessionContainer, StatelessSessionContainer

public abstract class BaseContainer extends Object implements Container, org.glassfish.enterprise.iiop.spi.EjbContainerFacade, com.sun.enterprise.container.common.spi.JavaEEContainer
This class implements part of the com.sun.ejb.Container interface. It implements the container's side of the EJB-to-Container contract definweed by the EJB 2.0 spec. It contains code shared by SessionBeans, EntityBeans and MessageDrivenBeans. Its subclasses provide the remaining implementation of the container functionality.
  • Field Details

    • _logger

      protected static final Logger _logger
    • NO_PARAMS

      protected static final Class[] NO_PARAMS
    • containerInfo

      protected final BaseContainer.ContainerInfo containerInfo
    • EJBObject_getPrimaryKey

      protected static final int EJBObject_getPrimaryKey
      See Also:
    • EJBLocalObject_getPrimaryKey

      protected static final int EJBLocalObject_getPrimaryKey
      See Also:
    • SINGLETON_BEAN_POOL_PROP

      protected static final String SINGLETON_BEAN_POOL_PROP
      See Also:
    • loader

      protected final ClassLoader loader
    • ejbClass

      protected Class<?> ejbClass
    • sfsbSerializedClass

      protected Class<?> sfsbSerializedClass
    • ejbPassivateMethod

      protected Method ejbPassivateMethod
    • ejbActivateMethod

      protected Method ejbActivateMethod
    • ejbRemoveMethod

      protected Method ejbRemoveMethod
    • webServiceEndpointIntf

      protected Class<?> webServiceEndpointIntf
    • isWebServiceEndpoint

      protected boolean isWebServiceEndpoint
    • isLocal

      protected boolean isLocal
      Data members for Local views *
    • hasLocalHomeView

      protected boolean hasLocalHomeView
    • hasLocalBusinessView

      protected boolean hasLocalBusinessView
    • hasOptionalLocalBusinessView

      protected boolean hasOptionalLocalBusinessView
    • ejbGeneratedOptionalLocalBusinessIntfClass

      protected Class<?> ejbGeneratedOptionalLocalBusinessIntfClass
    • localHomeIntf

      protected Class<?> localHomeIntf
    • ejbLocalHome

      protected jakarta.ejb.EJBLocalHome ejbLocalHome
    • ejbLocalHomeImpl

      protected EJBLocalHomeImpl ejbLocalHomeImpl
    • localBusinessHomeIntf

      protected Class localBusinessHomeIntf
    • ejbOptionalLocalBusinessHomeIntf

      protected Class ejbOptionalLocalBusinessHomeIntf
    • localBusinessIntfs

      protected Set<Class> localBusinessIntfs
    • ejbLocalBusinessHome

      protected GenericEJBLocalHome ejbLocalBusinessHome
    • ejbOptionalLocalBusinessHome

      protected GenericEJBLocalHome ejbOptionalLocalBusinessHome
    • ejbLocalBusinessHomeImpl

      protected EJBLocalHomeImpl ejbLocalBusinessHomeImpl
    • ejbOptionalLocalBusinessHomeImpl

      protected EJBLocalHomeImpl ejbOptionalLocalBusinessHomeImpl
    • isRemote

      protected boolean isRemote
      Data members for Remote views *
    • hasRemoteHomeView

      protected boolean hasRemoteHomeView
    • hasRemoteBusinessView

      protected boolean hasRemoteBusinessView
    • homeIntf

      protected Class homeIntf
    • remoteIntf

      protected Class remoteIntf
    • ejbHomeImpl

      protected EJBHomeImpl ejbHomeImpl
    • ejbHome

      protected jakarta.ejb.EJBHome ejbHome
    • ejbHomeStub

      protected jakarta.ejb.EJBHome ejbHomeStub
    • remoteHomeRefFactory

      protected org.glassfish.enterprise.iiop.api.RemoteReferenceFactory remoteHomeRefFactory
    • remoteBusinessHomeIntf

      protected Class remoteBusinessHomeIntf
    • ejbRemoteBusinessHomeImpl

      protected EJBHomeImpl ejbRemoteBusinessHomeImpl
    • ejbRemoteBusinessHome

      protected jakarta.ejb.EJBHome ejbRemoteBusinessHome
    • ejbRemoteBusinessHomeStub

      protected jakarta.ejb.EJBHome ejbRemoteBusinessHomeStub
    • remoteBusinessIntfInfo

      protected Map<String,com.sun.ejb.containers.RemoteBusinessIntfInfo> remoteBusinessIntfInfo
    • metadata

      protected jakarta.ejb.EJBMetaData metadata
    • securityManager

      protected final com.sun.enterprise.security.SecurityManager securityManager
    • isSession

      protected boolean isSession
    • isStatelessSession

      protected boolean isStatelessSession
    • isStatefulSession

      protected boolean isStatefulSession
    • isMessageDriven

      protected boolean isMessageDriven
    • isSingleton

      protected boolean isSingleton
    • ejbDescriptor

      protected EjbDescriptor ejbDescriptor
    • componentId

      protected String componentId
    • invocationInfoMap

      protected Map<Method,InvocationInfo> invocationInfoMap
    • scheduleIds

      protected Map<TimerPrimaryKey,Method> scheduleIds
    • webServiceInvocationInfoMap

      protected Map<Method,InvocationInfo> webServiceInvocationInfoMap
    • ejbIntfMethods

      protected Method[] ejbIntfMethods
    • ejbIntfMethodInfo

      protected InvocationInfo[] ejbIntfMethodInfo
    • envProps

      protected Properties envProps
    • isBeanManagedTran

      protected boolean isBeanManagedTran
    • debugMonitorFlag

      protected boolean debugMonitorFlag
    • CONTAINER_INITIALIZING

      protected static final int CONTAINER_INITIALIZING
      See Also:
    • CONTAINER_STARTED

      protected static final int CONTAINER_STARTED
      See Also:
    • CONTAINER_STOPPED

      protected static final int CONTAINER_STOPPED
      See Also:
    • CONTAINER_UNDEPLOYED

      protected static final int CONTAINER_UNDEPLOYED
      See Also:
    • CONTAINER_ON_HOLD

      protected static final int CONTAINER_ON_HOLD
      See Also:
    • containerState

      protected int containerState
    • methodMonitorMap

      protected HashMap methodMonitorMap
    • monitorOn

      protected boolean monitorOn
    • ejbProbeListener

      protected EjbMonitoringStatsProvider ejbProbeListener
    • ejbProbeNotifier

      protected EjbMonitoringProbeProvider ejbProbeNotifier
    • timerProbeListener

      protected EjbTimedObjectStatsProvider timerProbeListener
    • timerProbeNotifier

      protected EjbTimedObjectProbeProvider timerProbeNotifier
    • poolProbeListener

      protected EjbPoolStatsProvider poolProbeListener
    • cacheProbeNotifier

      protected EjbCacheProbeProvider cacheProbeNotifier
    • cacheProbeListener

      protected EjbCacheStatsProvider cacheProbeListener
    • callFlowInfo

      protected com.sun.enterprise.admin.monitor.callflow.CallFlowInfo callFlowInfo
    • interceptorManager

      protected InterceptorManager interceptorManager
    • invocationManager

      protected org.glassfish.api.invocation.InvocationManager invocationManager
    • injectionManager

      protected com.sun.enterprise.container.common.spi.util.InjectionManager injectionManager
    • namingManager

      protected org.glassfish.api.naming.GlassfishNamingManager namingManager
    • transactionManager

      protected com.sun.enterprise.transaction.api.JavaEETransactionManager transactionManager
    • ejbContainerUtilImpl

      protected EjbContainerUtil ejbContainerUtilImpl
    • optIntfClassLoader

      protected EjbOptionalIntfGenerator optIntfClassLoader
    • containerStateManager

      protected EJBContainerStateManager containerStateManager
    • containerTransactionManager

      protected EJBContainerTransactionManager containerTransactionManager
  • Constructor Details

  • Method Details

    • getProtocolManager

      protected org.glassfish.enterprise.iiop.api.ProtocolManager getProtocolManager()
    • getContainerInfo

      public BaseContainer.ContainerInfo getContainerInfo()
    • doEJBHomeRemove

      protected void doEJBHomeRemove(Object pk, Method m, boolean isLocal) throws RemoteException, jakarta.ejb.RemoveException
      Throws:
      RemoteException
      jakarta.ejb.RemoveException
    • initializeProtocolManager

      protected void initializeProtocolManager()
    • preInitialize

      protected void preInitialize(EjbDescriptor ejbDesc, ClassLoader loader)
    • checkUserTransactionLookup

      public void checkUserTransactionLookup(org.glassfish.api.invocation.ComponentInvocation inv) throws NameNotFoundException
      Throws:
      NameNotFoundException
    • createCallFlowAgent

      protected final void createCallFlowAgent(com.sun.enterprise.admin.monitor.callflow.ComponentType compType)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • setStartedState

      public final void setStartedState()
      Description copied from interface: Container
      Start servicing invocations for EJB instances in this Container.
      Specified by:
      setStartedState in interface Container
    • setStoppedState

      public final void setStoppedState()
      Description copied from interface: Container
      Stop servicing invocations for EJB instances in this Container. Subsequent EJB invocations will receive exceptions. Invocations already in progress will be allowed to complete eventually.
      Specified by:
      setStoppedState in interface Container
    • isStopped

      public final boolean isStopped()
    • setUndeployedState

      public final void setUndeployedState()
      Description copied from interface: Container
      Stop servicing invocations for EJB instances in this Container as the container is being undeployed. No new EJB invocations will be accepted from now on. Invocations already in progress will be allowed to complete eventually.
      Specified by:
      setUndeployedState in interface Container
    • isUndeployed

      public final boolean isUndeployed()
    • isTimedObject

      public final boolean isTimedObject()
      Description copied from interface: Container
      Returns true if this Container uses EJB Timer Service.
      Specified by:
      isTimedObject in interface Container
    • isLocalObject

      public final boolean isLocalObject()
      Description copied from interface: Container
      Returns true if the bean associated with this Container has a LocalHome/Local view OR a Local business view OR both.
      Specified by:
      isLocalObject in interface Container
    • isRemoteObject

      public final boolean isRemoteObject()
      Description copied from interface: Container
      Returns true if the bean associated with this Container has a RemoteHome/Remote view OR a Remote business view OR both.
      Specified by:
      isRemoteObject in interface Container
    • getContainerClassLoader

      public final ClassLoader getContainerClassLoader()
      Specified by:
      getContainerClassLoader in interface com.sun.enterprise.container.common.spi.JavaEEContainer
    • getClassLoader

      public final ClassLoader getClassLoader()
      Specified by:
      getClassLoader in interface Container
      Specified by:
      getClassLoader in interface org.glassfish.enterprise.iiop.spi.EjbContainerFacade
      Returns:
      the classloader of this container instance.
    • getUseThreadPoolId

      public final String getUseThreadPoolId()
      Specified by:
      getUseThreadPoolId in interface org.glassfish.enterprise.iiop.spi.EjbContainerFacade
    • getPassByReference

      public final boolean getPassByReference()
      Specified by:
      getPassByReference in interface org.glassfish.enterprise.iiop.spi.EjbContainerFacade
    • getContainerId

      protected final long getContainerId()
    • getApplicationId

      public final long getApplicationId()
    • getEjbDescriptor

      public final EjbDescriptor getEjbDescriptor()
      Specified by:
      getEjbDescriptor in interface Container
      Specified by:
      getEjbDescriptor in interface org.glassfish.enterprise.iiop.spi.EjbContainerFacade
      Returns:
      the EjbDescriptor containing deployment information for the EJB type corresponding to this Container instance.
    • getDescriptor

      public final org.glassfish.deployment.common.Descriptor getDescriptor()
      Method defined on JavaEEContainer
      Specified by:
      getDescriptor in interface com.sun.enterprise.container.common.spi.JavaEEContainer
    • getEJBMetaData

      public final jakarta.ejb.EJBMetaData getEJBMetaData()
      Specified by:
      getEJBMetaData in interface Container
      Returns:
      the MetaData for this EJB type.
    • getUserTransaction

      public final jakarta.transaction.UserTransaction getUserTransaction()
    • isHAEnabled

      public boolean isHAEnabled()
    • userTransactionMethodsAllowed

      public boolean userTransactionMethodsAllowed(org.glassfish.api.invocation.ComponentInvocation inv)
      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 interface Container
    • getEJBHomeStub

      public final jakarta.ejb.EJBHome getEJBHomeStub()
    • getEJBHome

      public final jakarta.ejb.EJBHome getEJBHome()
      Specified by:
      getEJBHome in interface Container
      Returns:
      the EJBHome object reference for this container instance.
    • getEJBLocalHome

      public final jakarta.ejb.EJBLocalHome getEJBLocalHome()
      Return an object that implements ejb's local home interface. If dynamic proxies are being used, this is the proxy itself, it can't be directly cast to an EJBLocalHomeImpl.
    • getEJBLocalBusinessHome

      public final GenericEJBLocalHome getEJBLocalBusinessHome(String clientViewClassName)
      Return an object that implements ejb's local business home interface.
    • getEJBClass

      public final Class getEJBClass()
    • getSecurityManager

      public final com.sun.enterprise.security.SecurityManager getSecurityManager()
      Specified by:
      getSecurityManager in interface Container
      Returns:
      A SecurityManager object for this container.
    • createRemoteReferenceWithId

      public Remote createRemoteReferenceWithId(byte[] instanceKey, String generatedRemoteBusinessIntf)
      Create an EJBObject reference from the instanceKey Called from EJBObjectOutputStream.SerializableRemoteRef during deserialization of a remote-ref
      Parameters:
      instanceKey - instanceKey of the ejbobject
      generatedRemoteBusinessIntf - non-null, this is a remote business view and the param is the name of the generated remote business interface. Otherwise, this is for the RemoteHome view
    • initializeHome

      protected void initializeHome() throws Exception
      Called from the ContainerFactory during initialization.
      Throws:
      Exception
    • setEJBMetaData

      protected void setEJBMetaData() throws Exception
      Throws:
      Exception
    • getJavaGlobalJndiNamePrefix

      protected org.glassfish.api.naming.SimpleJndiName getJavaGlobalJndiNamePrefix()
    • createEjbInstanceForInterceptors

      public void createEjbInstanceForInterceptors(Object[] params, EJBContextImpl ctx) throws Exception
      Throws:
      Exception
    • createEjbInstanceAndContext

      protected EJBContextImpl createEjbInstanceAndContext() throws Exception
      Throws:
      Exception
    • _constructEJBContextImpl

      protected EJBContextImpl _constructEJBContextImpl(Object instance)
    • _constructEJBInstance

      protected Object _constructEJBInstance() throws Exception
      Throws:
      Exception
    • injectEjbInstance

      protected void injectEjbInstance(EJBContextImpl context) throws Exception
      Throws:
      Exception
    • cleanupInstance

      protected void cleanupInstance(EJBContextImpl context)
    • getTargetObject

      public Remote getTargetObject(byte[] instanceKey, String generatedRemoteBusinessIntf)
      Return the EJBObject/EJBHome Proxy for the given ejbId and instanceKey. Called from the ProtocolManager when a remote invocation arrives.
      Specified by:
      getTargetObject in interface Container
      Specified by:
      getTargetObject in interface org.glassfish.enterprise.iiop.spi.EjbContainerFacade
      generatedRemoteBusinessIntf - True if this invocation is for the RemoteHome view of the bean. False if for the RemoteBusiness view. Called from the ProtocolManager when a remote invocation arrives.
      Throws:
      jakarta.ejb.NoSuchObjectLocalException - if the target object does not exist
    • releaseTargetObject

      public void releaseTargetObject(Remote remoteObj)
      Release the EJBObject/EJBHome object. Called from the ProtocolManager after a remote invocation completes.
      Specified by:
      releaseTargetObject in interface Container
      Specified by:
      releaseTargetObject in interface org.glassfish.enterprise.iiop.spi.EjbContainerFacade
    • externalPreInvoke

      public void externalPreInvoke()
      Description copied from interface: Container
      Performs pre external invocation setup such as setting application context class loader. Called by getTargetObject() and web service inv
      Specified by:
      externalPreInvoke in interface Container
    • externalPostInvoke

      public void externalPostInvoke()
      Description copied from interface: Container
      Performs post external invocation cleanup such as restoring the original class loader. Called by releaseTargetObject() and web service inv
      Specified by:
      externalPostInvoke in interface Container
    • preInvoke

      public void preInvoke(EjbInvocation inv)
      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
    • intercept

      public boolean intercept(com.sun.enterprise.deployment.LifecycleCallbackDescriptor.CallbackType eventType, EJBContextImpl ctx) throws Throwable
      Throws:
      Throwable
    • enlistExtendedEntityManagers

      protected void enlistExtendedEntityManagers(ComponentContext ctx)
    • delistExtendedEntityManagers

      protected void delistExtendedEntityManagers(ComponentContext ctx)
    • lookupExtendedEntityManager

      public jakarta.persistence.EntityManager lookupExtendedEntityManager(jakarta.persistence.EntityManagerFactory emf)
      Containers that allow extended EntityManager will override this method.
      Specified by:
      lookupExtendedEntityManager in interface com.sun.enterprise.container.common.spi.JavaEEContainer
    • webServicePostInvoke

      public void webServicePostInvoke(EjbInvocation inv)
      Description copied from interface: Container
      Called by webservice code to do ejb invocation post processing.
      Specified by:
      webServicePostInvoke in interface Container
    • postInvoke

      public void postInvoke(EjbInvocation inv)
      Called from EJBObject/EJBHome after invoking on bean.
      Specified by:
      postInvoke in interface Container
    • postInvoke

      protected void postInvoke(EjbInvocation inv, boolean doTxProcessing)
    • authorizeLocalMethod

      protected void authorizeLocalMethod(int method)
      Check if caller is authorized to invoke the method. Only called for EJBLocalObject and EJBLocalHome methods, from EJBLocalHome|ObjectImpl classes.
      Parameters:
      method - an integer identifying the method to be checked, must be one of the EJBLocal{Home|Object}_* constants.
    • authorizeRemoteMethod

      protected void authorizeRemoteMethod(int method) throws RemoteException
      Check if caller is authorized to invoke the method. Only called for EJBObject and EJBHome methods, from EJBHome|ObjectImpl classes.
      Parameters:
      method - an integer identifying the method to be checked, must be one of the EJB{Home|Object}_* constants.
      Throws:
      RemoteException
    • authorize

      public boolean authorize(EjbInvocation invocation)
      Common code to handle EJB security manager authorization call.
      Specified by:
      authorize in interface Container
    • cancelTimers

      protected void cancelTimers(Object key)
    • isEjbTimeoutMethod

      protected boolean isEjbTimeoutMethod(Method m)
    • createEJBObjectImpl

      protected abstract EJBObjectImpl createEJBObjectImpl() throws jakarta.ejb.CreateException, RemoteException
      Throws:
      jakarta.ejb.CreateException
      RemoteException
    • createEJBLocalObjectImpl

      protected EJBLocalObjectImpl createEJBLocalObjectImpl() throws jakarta.ejb.CreateException
      Throws:
      jakarta.ejb.CreateException
    • getEJBObjectImpl

      protected abstract EJBObjectImpl getEJBObjectImpl(byte[] streamKey)
      Called when a remote invocation arrives for an EJB. Implemented in subclasses.
    • getEJBLocalObjectImpl

      protected EJBLocalObjectImpl getEJBLocalObjectImpl(Object key)
    • checkExists

      protected void checkExists(EJBLocalRemoteObject ejbObj)
      Check if the given EJBObject/LocalObject has been removed.
      Throws:
      jakarta.ejb.NoSuchObjectLocalException - if the object has been removed.
    • getContext

      protected final ComponentContext getContext(EjbInvocation inv) throws jakarta.ejb.EJBException
      Throws:
      jakarta.ejb.EJBException
    • getInvocationKey

      protected final Object getInvocationKey(EjbInvocation inv)
    • _getContext

      protected abstract ComponentContext _getContext(EjbInvocation inv) throws jakarta.ejb.EJBException
      Throws:
      jakarta.ejb.EJBException
    • releaseContext

      protected abstract void releaseContext(EjbInvocation inv) throws jakarta.ejb.EJBException
      Throws:
      jakarta.ejb.EJBException
    • passivateEJB

      protected abstract boolean passivateEJB(ComponentContext context)
    • forceDestroyBean

      protected abstract void forceDestroyBean(EJBContextImpl sc) throws jakarta.ejb.EJBException
      Throws:
      jakarta.ejb.EJBException
    • removeBean

      protected abstract void removeBean(EJBLocalRemoteObject ejbo, Method removeMethod, boolean local) throws jakarta.ejb.RemoveException, jakarta.ejb.EJBException, RemoteException
      Throws:
      jakarta.ejb.RemoveException
      jakarta.ejb.EJBException
      RemoteException
    • authorizeLocalGetPrimaryKey

      protected void authorizeLocalGetPrimaryKey(EJBLocalRemoteObject ejbObj) throws jakarta.ejb.EJBException
      Throws:
      jakarta.ejb.EJBException
    • authorizeRemoteGetPrimaryKey

      protected void authorizeRemoteGetPrimaryKey(EJBLocalRemoteObject ejbObj) throws RemoteException
      Throws:
      RemoteException
    • invokeFindByPrimaryKey

      protected Object invokeFindByPrimaryKey(Method method, EjbInvocation inv, Object[] args) throws Throwable
      Throws:
      Throwable
    • removeBeanUnchecked

      public void removeBeanUnchecked(Object pkey)
      Description copied from interface: Container
      Remove a bean given primary key. Used by the PersistenceManager.
      Specified by:
      removeBeanUnchecked in interface Container
    • removeBeanUnchecked

      public void removeBeanUnchecked(jakarta.ejb.EJBLocalObject bean)
      Description copied from interface: Container
      Remove a bean. Used by the PersistenceManager.
      Specified by:
      removeBeanUnchecked in interface Container
    • preSelect

      public void preSelect()
      Description copied from interface: Container
      Notification from persistence manager than an ejbSelect query is about to be invoked on a bean of the ejb type for this container. This allows the ejb container to perform the same set of actions as take place before a finder method, such as calling ejbStore on bean instances. (See EJB 2.1, Section 10.5.3 ejbFind,ejbStore)
      Specified by:
      preSelect in interface Container
    • getEJBLocalObjectForPrimaryKey

      public jakarta.ejb.EJBLocalObject getEJBLocalObjectForPrimaryKey(Object pkey, jakarta.ejb.EJBContext ctx)
      Description copied from interface: Container
      Obtain an Entity EJBLocalObject corresponding to the primary key. Used by the PersistenceManager.
      Specified by:
      getEJBLocalObjectForPrimaryKey in interface Container
    • getEJBLocalObjectForPrimaryKey

      public jakarta.ejb.EJBLocalObject getEJBLocalObjectForPrimaryKey(Object pkey)
      Specified by:
      getEJBLocalObjectForPrimaryKey in interface Container
    • getEJBObjectForPrimaryKey

      public jakarta.ejb.EJBObject getEJBObjectForPrimaryKey(Object pkey)
      Description copied from interface: Container
      Obtain an Entity EJBObject corresponding to the primary key. Used by the PersistenceManager.
      Specified by:
      getEJBObjectForPrimaryKey in interface Container
    • isIdentical

      protected boolean isIdentical(EJBObjectImpl ejbo, jakarta.ejb.EJBObject other) throws RemoteException
      Throws:
      RemoteException
    • getJaccEjb

      public Object getJaccEjb(EjbInvocation ejbInvocation)
      Called-back from security implementation through EjbInvocation when a jacc policy provider wants an enterprise bean instance.
      Specified by:
      getJaccEjb in interface Container
      Returns:
      EnterpriseBean instance or null if not applicable for this invocation.
    • assertValidLocalObject

      public void assertValidLocalObject(Object o) throws jakarta.ejb.EJBException
      Description copied from interface: Container
      Verify that a given object is an EJBLocalObject of an ejb from this ejb container. The given object must be an EJBLocalObject and have the same ejb type ( meaning same ejb-jar and same ejb-name ) as this container. Note that for entity beans this equality check is independent of primary key.
      Specified by:
      assertValidLocalObject in interface Container
      Throws:
      jakarta.ejb.EJBException - Thrown when the assertion fails.
    • assertValidRemoteObject

      public void assertValidRemoteObject(Object o) throws jakarta.ejb.EJBException
      Asserts validity of RemoteHome objects. This was defined for the J2EE 1.4 implementation and is exposed through Container SPI.
      Specified by:
      assertValidRemoteObject in interface Container
      Throws:
      jakarta.ejb.EJBException - Thrown when the assertion fails.
    • getTxAttr

      protected final int getTxAttr(Method method, String methodIntf) throws jakarta.ejb.EJBException
      Throws:
      jakarta.ejb.EJBException
    • getTxAttr

      protected final int getTxAttr(EjbInvocation inv) throws jakarta.ejb.EJBException
      Throws:
      jakarta.ejb.EJBException
    • isCreateHomeFinder

      protected boolean isCreateHomeFinder(Method method)
    • addInvocationInfo

      protected InvocationInfo addInvocationInfo(Method method, String methodIntf, Class originalIntf) throws jakarta.ejb.EJBException
      Throws:
      jakarta.ejb.EJBException
    • adjustInvocationInfo

      protected void adjustInvocationInfo(InvocationInfo invInfo, Method method, int txAttr, boolean flushEnabled, String methodIntf, Class originalIntf) throws jakarta.ejb.EJBException
      Throws:
      jakarta.ejb.EJBException
    • postProcessInvocationInfo

      protected InvocationInfo postProcessInvocationInfo(InvocationInfo invInfo)
    • adjustHomeTargetMethodInfo

      protected void adjustHomeTargetMethodInfo(InvocationInfo invInfo, String methodName, Class[] paramTypes) throws NoSuchMethodException
      Throws:
      NoSuchMethodException
    • getPre30LifecycleMethodNames

      protected String[] getPre30LifecycleMethodNames()
    • registerSystemInterceptor

      public void registerSystemInterceptor(Object interceptor)
      Can be called after original interceptor initialization. Install the given interceptor class instance before any application level interceptors.
      Parameters:
      interceptor - optionally specified delegate to be set on SystemInterceptorProxy
    • addLocalRemoteInvocationInfo

      protected void addLocalRemoteInvocationInfo() throws Exception
      Throws:
      Exception
    • validateTxAttr

      protected void validateTxAttr(com.sun.enterprise.deployment.MethodDescriptor md, int txAttr) throws jakarta.ejb.EJBException
      Validate transaction attribute value. Allow subclasses to add their own validation.
      Throws:
      jakarta.ejb.EJBException
    • findFlushEnabledAttr

      protected boolean findFlushEnabledAttr(com.sun.enterprise.deployment.MethodDescriptor md)
    • addProxyInterfacesSetClass

      protected void addProxyInterfacesSetClass(Set proxyInterfacesSet, boolean local)
    • getEJBHomeInvocationHandler

      protected EJBHomeInvocationHandler getEJBHomeInvocationHandler(Class homeIntfClass) throws Exception
      Throws:
      Exception
    • createEjbInvocation

      protected EjbInvocation createEjbInvocation()
    • createEjbInvocation

      protected EjbInvocation createEjbInvocation(Object ejb, ComponentContext context)
    • getEJBLocalHomeInvocationHandler

      protected EJBLocalHomeInvocationHandler getEJBLocalHomeInvocationHandler(Class homeIntfClass) throws Exception
      Throws:
      Exception
    • instantiateEJBLocalObjectImpl

      protected EJBLocalObjectImpl instantiateEJBLocalObjectImpl() throws Exception
      Throws:
      Exception
    • instantiateEJBLocalObjectImpl

      protected EJBLocalObjectImpl instantiateEJBLocalObjectImpl(Object key) throws Exception
      Throws:
      Exception
    • instantiateEJBLocalBusinessObjectImpl

      protected EJBLocalObjectImpl instantiateEJBLocalBusinessObjectImpl() throws Exception
      Throws:
      Exception
    • instantiateOptionalEJBLocalBusinessObjectImpl

      protected EJBLocalObjectImpl instantiateOptionalEJBLocalBusinessObjectImpl() throws Exception
      Throws:
      Exception
    • instantiateEJBObjectImpl

      protected EJBObjectImpl instantiateEJBObjectImpl() throws Exception
      Throws:
      Exception
    • instantiateEJBObjectImpl

      protected EJBObjectImpl instantiateEJBObjectImpl(jakarta.ejb.EJBObject ejbStub, Object key) throws Exception
      Throws:
      Exception
    • instantiateRemoteBusinessObjectImpl

      protected EJBObjectImpl instantiateRemoteBusinessObjectImpl() throws Exception
      Throws:
      Exception
    • scanForEjbCreateMethod

      public boolean scanForEjbCreateMethod()
    • postCreate

      public void postCreate(EjbInvocation inv, Object primaryKey) throws jakarta.ejb.CreateException
      Description copied from interface: Container
      Called by the EJB(Local)Home after invoking ejbCreate on an EntityBean. After this postCreate the EJB(Local)Home can call ejbPostCreate on the EntityBean.
      Specified by:
      postCreate in interface Container
      primaryKey - the value returned from ejbCreate.
      Throws:
      jakarta.ejb.CreateException
    • postFind

      public Object postFind(EjbInvocation inv, Object primaryKeys, Object[] findParams) throws jakarta.ejb.FinderException
      Description copied from interface: Container
      Called by the EJB(Local)Home after invoking ejbFind* on an EntityBean.
      Specified by:
      postFind in interface Container
      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:
      jakarta.ejb.FinderException
    • getComponentId

      public String getComponentId()
      Called from NamingManagerImpl during java:comp/env lookup.
      Specified by:
      getComponentId in interface Container
      Specified by:
      getComponentId in interface com.sun.enterprise.container.common.spi.JavaEEContainer
    • startApplication

      public void startApplication(boolean deploy)
      Called after all the components in the container's application have deployed successfully.
      Specified by:
      startApplication in interface Container
      Parameters:
      deploy - true if this method is called during application deploy
    • callEJBTimeout

      protected boolean callEJBTimeout(RuntimeTimerState timerState, EJBTimerService timerService) throws Exception
      Throws:
      Exception
    • getTimeoutMethod

      protected Method getTimeoutMethod(RuntimeTimerState timerState)
    • postEjbTimeout

      protected boolean postEjbTimeout(RuntimeTimerState timerState, EJBTimerService timerService)
    • prepareEjbTimeoutParams

      protected void prepareEjbTimeoutParams(EjbInvocation inv, RuntimeTimerState timerState, EJBTimerService timerService)
    • onEnteringContainer

      public final void onEnteringContainer()
      Description copied from interface: Container
      Called when the request started it's processing in the container
      Specified by:
      onEnteringContainer in interface Container
    • onLeavingContainer

      public final void onLeavingContainer()
      Description copied from interface: Container
      Called when the request finished it's processing in the container
      Specified by:
      onLeavingContainer in interface Container
    • invokeTargetBeanMethod

      protected Object invokeTargetBeanMethod(Method beanClassMethod, EjbInvocation inv, Object target, Object[] params, com.sun.enterprise.security.SecurityManager mgr) throws Throwable
      Throws:
      Throwable
    • doTimerInvocationInit

      protected void doTimerInvocationInit(EjbInvocation inv, Object primaryKey) throws Exception
      This is implemented by concrete containers that support TimedObjects.
      Throws:
      Exception
    • undeploy

      public final void undeploy()
      Undeploy event. Code must be able to gracefully handle redundant undeploy/shutdown calls for the same container instance.
      Specified by:
      undeploy in interface Container
    • onShutdown

      public final void onShutdown()
      Container shutdown event. This happens for every kind of shutdown other than undeploy. It could mean the server is shutting down or that the app has been disabled while the server is still running. The two cases are handled the same. We must be able to gracefully handle redundant shutdown calls for the same container instance.
      Specified by:
      onShutdown in interface Container
    • doConcreteContainerShutdown

      protected abstract void doConcreteContainerShutdown(boolean appBeingUndeployed)
    • onReady

      public void onReady()
      Called when server instance is Ready
      Specified by:
      onReady in interface Container
    • onTermination

      public void onTermination()
      Called when server instance is terminating. This method is the last one called during server shutdown.
      Specified by:
      onTermination in interface Container
    • preInvokeTx

      protected final void preInvokeTx(EjbInvocation inv) throws Exception
      This is called from preInvoke before every method invocation on the EJB instance, including ejbCreate, ejbFind*, ejbRemove. Also called from MessageBeanContainer, WebServiceInvocationHandler, etc, so we can't assume that BaseContainer.preInvoke(EjbInvocation) has run. Therefore, handle inv.invocationInfo defensively since it might not have been initialized.
      Throws:
      Exception
    • checkUnfinishedTx

      protected void checkUnfinishedTx(jakarta.transaction.Transaction prevTx, EjbInvocation inv)
    • suspendTransaction

      protected boolean suspendTransaction(EjbInvocation inv) throws Exception
      Throws:
      Exception
    • resumeTransaction

      protected boolean resumeTransaction(EjbInvocation inv) throws Exception
      Throws:
      Exception
    • useClientTx

      protected void useClientTx(jakarta.transaction.Transaction prevTx, EjbInvocation inv)
    • validateEMForClientTx

      protected void validateEMForClientTx(EjbInvocation inv, com.sun.enterprise.transaction.api.JavaEETransaction t)
    • postInvokeTx

      protected void postInvokeTx(EjbInvocation inv) throws Exception
      postInvokeTx is called after every invocation on the EJB instance, including ejbCreate/ejbFind---/ejbRemove. NOTE: postInvokeTx is called even if the EJB was not invoked because of an exception thrown from preInvokeTx.
      Throws:
      Exception
    • checkExceptionClientTx

      protected Throwable checkExceptionClientTx(EJBContextImpl context, Throwable exception) throws Exception
      Throws:
      Exception
    • doAfterBegin

      public final void doAfterBegin(org.glassfish.api.invocation.ComponentInvocation ci)
      Description copied from interface: Container
      Called from the TM when an EJB with Bean-Managed transactions starts a tx
      Specified by:
      doAfterBegin in interface Container
    • afterBegin

      protected abstract void afterBegin(EJBContextImpl context)
    • beforeCompletion

      protected abstract void beforeCompletion(EJBContextImpl context)
    • afterCompletion

      protected abstract void afterCompletion(EJBContextImpl context, int status)
    • preInvokeNoTx

      protected void preInvokeNoTx(EjbInvocation inv)
    • postInvokeNoTx

      protected void postInvokeNoTx(EjbInvocation inv)
    • isApplicationException

      protected boolean isApplicationException(Throwable exception)
    • isSystemUncheckedException

      protected boolean isSystemUncheckedException(Throwable exception)
    • getDebugMonitorFlag

      public boolean getDebugMonitorFlag()
    • setDebugMonitorFlag

      public void setDebugMonitorFlag(boolean flag)
    • containerStateToString

      protected static final String containerStateToString(int state)
    • isRemoteInterfaceSupported

      protected final boolean isRemoteInterfaceSupported()
    • isLocalInterfaceSupported

      protected final boolean isLocalInterfaceSupported()
    • getTxAttrForLifecycleCallback

      protected int getTxAttrForLifecycleCallback(Set<com.sun.enterprise.deployment.LifecycleCallbackDescriptor> lifecycleCallbackDescriptors, int defaultTxAttr, int... validateTxAttr) throws Exception
      Throws:
      Exception
    • intercept

      protected Object intercept(EjbInvocation inv) throws Throwable
      Called from various places within the container that are responsible for dispatching invocations to business methods. This method has the exception semantics of Method.invoke(). Any exception that originated from the business method or application code within an interceptor will be propagated as the cause within an InvocationTargetException.
      Throws:
      Throwable
    • invokeBeanMethod

      public Object invokeBeanMethod(EjbInvocation invocation) throws Throwable
      Called from Interceptor Chain to invoke the actual bean method.

      This method must throw any exception from the bean method *as is*, without being wrapped in an InvocationTargetException. The exception thrown from this method will be propagated through the application's interceptor code, so it must not be changed in order for any exception handling logic in that code to function properly.

      Throws:
      Throwable
    • getMonitoringStatsProvider

      protected abstract EjbMonitoringStatsProvider getMonitoringStatsProvider(String appName, String modName, String ejbName)
    • createMonitoringRegistry

      protected void createMonitoringRegistry()
    • getMonitoringMethodsArray

      protected String[] getMonitoringMethodsArray()
    • getMonitoringMethodsArray

      protected String[] getMonitoringMethodsArray(boolean hasGeneratedClasses)
    • doFlush

      protected void doFlush(EjbInvocation inv)
    • registerMonitorableComponents

      protected void registerMonitorableComponents()
    • registerTimerMonitorableComponent

      protected void registerTimerMonitorableComponent()
    • incrementCreatedTimedObject

      protected void incrementCreatedTimedObject()
    • incrementRemovedTimedObject

      protected void incrementRemovedTimedObject()
    • incrementDeliveredTimedObject

      protected void incrementDeliveredTimedObject()