public final class MessageBeanContainer extends BaseContainer implements MessageBeanProtocolManager
The 3 states of a Message-driven EJB (an EJB can be in only 1 state at a time): 1. POOLED : ready for invocations, no transaction in progress 2. INVOKING : processing an invocation 3. DESTROYED : does not exist A Message-driven Bean can hold open DB connections across invocations. It's assumed that the Resource Manager can handle multiple incomplete transactions on the same connection.
Modifier and Type | Class and Description |
---|---|
static class |
MessageBeanContainer.MessageDeliveryType |
BaseContainer.ContainerInfo, BaseContainer.ContainerType, BaseContainer.PreInvokeException
cacheProbeListener, cacheProbeNotifier, callFlowInfo, componentId, CONTAINER_INITIALIZING, CONTAINER_ON_HOLD, CONTAINER_STARTED, CONTAINER_STOPPED, CONTAINER_UNDEPLOYED, containerInfo, containerState, containerStateManager, containerTransactionManager, containerType, debugMonitorFlag, ejbActivateMethod, ejbClass, ejbContainerUtilImpl, ejbDescriptor, ejbGeneratedOptionalLocalBusinessIntfClass, ejbHome, ejbHomeImpl, ejbHomeStub, ejbIntfMethodInfo, ejbIntfMethods, ejbLocalBusinessHome, ejbLocalBusinessHomeImpl, ejbLocalHome, ejbLocalHomeImpl, EJBLocalObject_getPrimaryKey, EJBObject_getPrimaryKey, ejbOptionalLocalBusinessHome, ejbOptionalLocalBusinessHomeImpl, ejbOptionalLocalBusinessHomeIntf, ejbPassivateMethod, ejbProbeListener, ejbProbeNotifier, ejbRemoteBusinessHome, ejbRemoteBusinessHomeImpl, ejbRemoteBusinessHomeStub, ejbRemoveMethod, envProps, executorProbeListener, hasLocalBusinessView, hasLocalHomeView, hasOptionalLocalBusinessView, hasRemoteBusinessView, hasRemoteHomeView, homeIntf, injectionManager, interceptorManager, invocationInfoMap, invocationManager, isBeanManagedTran, isLocal, isMessageDriven, isRemote, isSession, isSingleton, isStatefulSession, isStatelessSession, isWebServiceEndpoint, jcdiService, loader, localBusinessHomeIntf, localBusinessIntfs, localHomeIntf, logParams, metadata, namingManager, NO_PARAMS, optIntfClassLoader, poolProbeListener, remoteBusinessHomeIntf, remoteBusinessIntfInfo, remoteHomeRefFactory, remoteIntf, scheduleIds, securityManager, sfsbSerializedClass, SINGLETON_BEAN_POOL_PROP, timerProbeListener, timerProbeNotifier, transactionManager, webServiceEndpointIntf, webServiceInvocationInfoMap
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
Modifier and Type | Method and Description |
---|---|
protected MessageBeanContextImpl |
_constructEJBContextImpl(Object instance)
Must be overridden for any container that supports injection
|
protected ComponentContext |
_getContext(EjbInvocation inv) |
void |
activateEJB(Object ctx,
Object instanceKey)
Deprecated.
not called and not used in Payara 5
|
protected void |
addLocalRemoteInvocationInfo() |
protected void |
afterBegin(EJBContextImpl context) |
protected void |
afterCompletion(EJBContextImpl ctx,
int status) |
void |
afterMessageDelivery(ResourceHandle resourceHandle) |
protected void |
beforeCompletion(EJBContextImpl context) |
void |
beforeMessageDelivery(Method method,
MessageBeanContainer.MessageDeliveryType deliveryType,
boolean txImported,
ResourceHandle resourceHandle)
Actual message delivery happens in three steps :
1) beforeMessageDelivery(Message, MessageListener) This is our chance to
make the message delivery itself part of the instance's global
transaction.
|
protected boolean |
callEJBTimeout(RuntimeTimerState timerState,
EJBTimerService timerService)
Override callEJBTimeout from BaseContainer since delivery to message
driven beans is a bit different from session/entity.
|
EJBObjectImpl |
createEJBObjectImpl() |
MessageBeanListener |
createMessageBeanListener(ResourceHandle resource)
Create a MessageBeanListener.
|
Object |
createMessageBeanProxy(InvocationHandler handler)
Generates the appropriate Proxy based on the message listener type.
|
Object |
deliverMessage(Object[] params) |
void |
destroyMessageBeanListener(MessageBeanListener listener)
Return the MessageBeanListener to the container.
|
protected void |
doConcreteContainerShutdown(boolean appBeingUndeployed)
Called by BaseContainer during container shutdown sequence
|
protected void |
forceDestroyBean(EJBContextImpl sc)
Force destroy the EJB.
|
EJBObjectImpl |
getEJBObjectImpl(byte[] instanceKey)
Called when a remote invocation arrives for an EJB.
|
long |
getMessageCount() |
String |
getMonitorAttributeValues() |
protected EjbMonitoringStatsProvider |
getMonitoringStatsProvider(String appName,
String modName,
String ejbName) |
BeanPoolDescriptor |
getPoolDescriptor()
Returns the message-bean container's pool properties.
|
protected void |
initializeHome()
Called from the ContainerFactory during initialization.
|
protected boolean |
isCreateHomeFinder(Method method) |
boolean |
isDeliveryTransacted(Method method)
This is used by the message provider to find out whether message
deliveries will be transacted or not.
|
boolean |
passivateEJB(ComponentContext context) |
void |
postInvoke(EjbInvocation inv)
TODO
public void appendStats(StringBuilder sbuf) {
sbuf.append("\nMessageBeanContainer: ").append("CreateCount=").append(
statCreateCount).append("; ").append("RemoveCount=").append(
statRemoveCount).append("; ").append("MsgCount=").append(
statMessageCount).append("; ");
sbuf.append("]");
}
|
void |
preInvoke(EjbInvocation inv)
Called from EJBObject/EJBHome before invoking on EJB.
|
protected void |
registerMonitorableComponents(Method[] msgListenerMethods) |
void |
releaseContext(EjbInvocation inv)
Return instance to a pooled state.
|
protected void |
removeBean(EJBLocalRemoteObject ejbo,
Method removeMethod,
boolean local) |
boolean |
scanForEjbCreateMethod() |
void |
setEJBHome(javax.ejb.EJBHome ejbHome) |
void |
startApplication(boolean deploy)
Called when the application containing this message-bean has
successfully gotten through the initial load phase of each
module.
|
protected static int |
stringToInt(String val,
String appName,
Logger logger) |
boolean |
userTransactionMethodsAllowed(ComponentInvocation inv)
EJB spec makes a distinction between access to the UserTransaction
object itself and access to its methods.
|
protected int |
validateValue(int value,
int lowLimit,
int highLimit,
int deft,
String emsg,
String appName,
Logger logger) |
_constructEJBInstance, _createJCDIInjectionContext, _createJCDIInjectionContext, addInvocationInfo, addProxyInterfacesSetClass, adjustHomeTargetMethodInfo, adjustInvocationInfo, assertValidLocalObject, assertValidRemoteObject, authorize, authorizeLocalGetPrimaryKey, authorizeLocalMethod, authorizeRemoteGetPrimaryKey, authorizeRemoteMethod, cancelTimers, checkExceptionClientTx, checkExists, checkUnfinishedTx, checkUserTransactionLookup, cleanupInstance, containerStateToString, createCallFlowAgent, createEjbInstanceAndContext, createEjbInstanceForInterceptors, createEjbInvocation, createEjbInvocation, createEJBLocalObjectImpl, createEmptyContextAndInterceptors, createMonitoringRegistry, createRemoteReferenceWithId, delistExtendedEntityManagers, doAfterBegin, doEJBHomeRemove, doFlush, doTimerInvocationInit, enlistExtendedEntityManagers, externalPostInvoke, externalPreInvoke, findFlushEnabledAttr, getApplicationId, getClassLoader, getComponentId, getContainerClassLoader, getContainerId, getContainerType, getContext, getDebugMonitorFlag, getDescriptor, getEJBClass, getEjbDescriptor, getEJBHome, getEJBHomeInvocationHandler, getEJBHomeStub, getEJBLocalBusinessHome, getEJBLocalHome, getEJBLocalHomeInvocationHandler, getEJBLocalObjectForPrimaryKey, getEJBLocalObjectForPrimaryKey, getEJBLocalObjectImpl, getEJBMetaData, getEJBObjectForPrimaryKey, getInvocationKey, getJaccEjb, getJavaGlobalJndiNamePrefix, getMonitoringMethodsArray, getMonitoringMethodsArray, getPassByReference, getPre30LifecycleMethodNames, getProtocolManager, getSecurityManager, getTargetObject, getTimeoutMethod, getTxAttr, getTxAttr, getTxAttrForLifecycleCallback, getUserTransaction, getUseThreadPoolId, incrementCreatedTimedObject, incrementDeliveredTimedObject, incrementRemovedTimedObject, initialize, initializeProtocolManager, injectEjbInstance, instantiateEJBLocalBusinessObjectImpl, instantiateEJBLocalObjectImpl, instantiateEJBLocalObjectImpl, instantiateEJBObjectImpl, instantiateEJBObjectImpl, instantiateOptionalEJBLocalBusinessObjectImpl, instantiateRemoteBusinessObjectImpl, intercept, intercept, invokeBeanMethod, invokeFindByPrimaryKey, invokeTargetBeanMethod, isApplicationException, isEjbTimeoutMethod, isHAEnabled, isIdentical, isJCDIEnabled, isLocalInterfaceSupported, isLocalObject, isRemoteInterfaceSupported, isRemoteObject, isStopped, isSystemUncheckedException, isTimedObject, isUndeployed, lookupExtendedEntityManager, onEnteringContainer, onLeavingContainer, onReady, onShutdown, onTermination, postCreate, postEjbTimeout, postFind, postInvoke, postInvokeNoTx, postInvokeTx, postProcessInvocationInfo, preInitialize, preInvokeNoTx, preInvokeTx, prepareEjbTimeoutParams, preSelect, registerMonitorableComponents, registerTimerMonitorableComponent, releaseTargetObject, removeBeanUnchecked, removeBeanUnchecked, resumeTransaction, setDebugMonitorFlag, setEJBMetaData, setStartedState, setStoppedState, setUndeployedState, suspendTransaction, toString, undeploy, useClientTx, validateEMForClientTx, validateTxAttr, webServicePostInvoke
protected void registerMonitorableComponents(Method[] msgListenerMethods)
protected EjbMonitoringStatsProvider getMonitoringStatsProvider(String appName, String modName, String ejbName)
getMonitoringStatsProvider
in class BaseContainer
public boolean scanForEjbCreateMethod()
scanForEjbCreateMethod
in class BaseContainer
protected void initializeHome() throws Exception
BaseContainer
initializeHome
in class BaseContainer
Exception
protected void addLocalRemoteInvocationInfo() throws Exception
addLocalRemoteInvocationInfo
in class BaseContainer
Exception
protected boolean isCreateHomeFinder(Method method)
isCreateHomeFinder
in class BaseContainer
protected int validateValue(int value, int lowLimit, int highLimit, int deft, String emsg, String appName, Logger logger)
public String getMonitorAttributeValues()
public boolean userTransactionMethodsAllowed(ComponentInvocation inv)
BaseContainer
userTransactionMethodsAllowed
in interface Container
userTransactionMethodsAllowed
in class BaseContainer
public EJBObjectImpl getEJBObjectImpl(byte[] instanceKey)
BaseContainer
getEJBObjectImpl
in class BaseContainer
public EJBObjectImpl createEJBObjectImpl() throws javax.ejb.CreateException
createEJBObjectImpl
in class BaseContainer
javax.ejb.CreateException
protected void removeBean(EJBLocalRemoteObject ejbo, Method removeMethod, boolean local) throws javax.ejb.RemoveException, javax.ejb.EJBException
removeBean
in class BaseContainer
javax.ejb.RemoveException
javax.ejb.EJBException
protected boolean callEJBTimeout(RuntimeTimerState timerState, EJBTimerService timerService) throws Exception
callEJBTimeout
in class BaseContainer
Exception
protected void forceDestroyBean(EJBContextImpl sc)
forceDestroyBean
in class BaseContainer
public void preInvoke(EjbInvocation inv)
BaseContainer
preInvoke
in interface Container
preInvoke
in class BaseContainer
protected ComponentContext _getContext(EjbInvocation inv)
_getContext
in class BaseContainer
public void releaseContext(EjbInvocation inv)
releaseContext
in class BaseContainer
public void postInvoke(EjbInvocation inv)
postInvoke
in interface Container
postInvoke
in class BaseContainer
public MessageBeanListener createMessageBeanListener(ResourceHandle resource) throws ResourcesExceededException
createMessageBeanListener
in interface MessageBeanProtocolManager
resource
- handle associated with this listener. can be null.ResourcesExceededException
public void destroyMessageBeanListener(MessageBeanListener listener)
MessageBeanProtocolManager
destroyMessageBeanListener
in interface MessageBeanProtocolManager
public boolean isDeliveryTransacted(Method method)
MessageBeanProtocolManager
isDeliveryTransacted
in interface MessageBeanProtocolManager
method
- One of the methods used to deliver messages, e.g. onMessage
method for javax.jms.MessageListener. Note that if the
method
is not one of the methods for message
delivery, the behavior of this method is not defined.public BeanPoolDescriptor getPoolDescriptor()
MessageBeanProtocolManager
getPoolDescriptor
in interface MessageBeanProtocolManager
public Object createMessageBeanProxy(InvocationHandler handler) throws Exception
createMessageBeanProxy
in interface MessageBeanProtocolManager
handler
- InvocationHandler responsible for calls on the proxyException
protected MessageBeanContextImpl _constructEJBContextImpl(Object instance)
BaseContainer
_constructEJBContextImpl
in class BaseContainer
EJBContextImpl
protected void afterBegin(EJBContextImpl context)
afterBegin
in class BaseContainer
protected void beforeCompletion(EJBContextImpl context)
beforeCompletion
in class BaseContainer
protected void afterCompletion(EJBContextImpl ctx, int status)
afterCompletion
in class BaseContainer
public boolean passivateEJB(ComponentContext context)
passivateEJB
in class BaseContainer
@Deprecated public void activateEJB(Object ctx, Object instanceKey)
public void startApplication(boolean deploy)
startApplication
in interface Container
startApplication
in class BaseContainer
deploy
- true if this method is called during application deployprotected void doConcreteContainerShutdown(boolean appBeingUndeployed)
doConcreteContainerShutdown
in class BaseContainer
appBeingUndeployed
- public void beforeMessageDelivery(Method method, MessageBeanContainer.MessageDeliveryType deliveryType, boolean txImported, ResourceHandle resourceHandle)
method
- deliveryType
- txImported
- resourceHandle
- public void afterMessageDelivery(ResourceHandle resourceHandle)
public long getMessageCount()
Copyright © 2021. All rights reserved.