org.jboss.ejb3.mdb
Class MDB

java.lang.Object
  extended by org.jboss.aop.Advisor
      extended by org.jboss.aop.ClassContainer
          extended by org.jboss.ejb3.EJBContainer
              extended by org.jboss.ejb3.mdb.MDB
All Implemented Interfaces:
org.jboss.ejb.txtimer.TimedObjectInvoker, Container

public class MDB
extends EJBContainer
implements org.jboss.ejb.txtimer.TimedObjectInvoker

Comment

Version:
$Revision: 1.10.2.3 $
Author:
Bill Burke

Field Summary
protected  AcknowledgementMode acknowledgeMode
           
protected  ActivationSpec activationSpec
           
protected  MDBConfig config
           
protected  javax.jms.Connection connection
           
protected  javax.jms.ConnectionConsumer connectionConsumer
           
protected static String DEFAULT_DESTINATION_TYPE
          Default destination type.
protected  DLQHandler dlqHandler
           
protected  org.jboss.ejb3.mdb.MDB.ExceptionListenerImpl exListener
           
protected  Method getServerSessionPool
          This is needed because API changed from JBoss 4.0.1sp1 to 4.0.2 TODO remove this after 4.0.2 is out.
protected  boolean isContainerManagedTx
           
protected  boolean isNotSupportedTx
           
protected  Method ON_MESSAGE
           
protected  javax.jms.ServerSessionPool serverSessionPool
           
protected  javax.ejb.TimerService timerService
           
 
Fields inherited from class org.jboss.ejb3.EJBContainer
beanClassName, beanContextClass, callbackHandler, classloader, defaultConstructorIndex, ejbLinkResolver, ejbName, enc, ENTITY_MANAGER_FACTORY, entityManagerFactory, envEntries, initialContextProperties, injectors, MANAGED_ENTITY_MANAGER_FACTORY, objectName, pool
 
Fields inherited from class org.jboss.aop.ClassContainer
advisedFields
 
Fields inherited from class org.jboss.aop.Advisor
adviceBindings, adviceInterceptors, advisedMethods, annotations, aspects, classAnnotations, classMetaData, classMetaDataBindings, clazz, constructionInterceptors, constructorInterceptors, constructorMetaData, constructors, defaultMetaData, doesHaveAspects, fieldMetaData, interfaceIntroductions, manager, methodInterceptors, methodMetaData, name, perInstanceAspectDefinitions, perInstanceJoinpointAspectDefinitions
 
Fields inherited from interface org.jboss.ejb3.Container
ENC_CTX_NAME
 
Constructor Summary
MDB(String ejbName, org.jboss.aop.AspectManager manager, ClassLoader cl, String beanClassName, Hashtable ctxProperties)
           
 
Method Summary
 void callTimeout(javax.ejb.Timer timer)
           
 void create()
          Initialize the container invoker.
protected  javax.jms.Destination createDestination(Class type, Context ctx, String jndiName, String jndiSuffix)
          Create and or lookup a JMS destination.
protected  javax.jms.ServerSessionPool createSessionPool(javax.jms.Destination dest, javax.jms.Connection connection, boolean isTransacted, int ack, javax.jms.MessageListener listener)
          Create a server session pool for the given connection.
 void destroy()
           
protected  String getDestinationType(Context ctx, String destinationJNDI)
          Try to get a destination type by looking up the destination JNDI, or provide a default if there is not destinationJNDI or if it is not possible to lookup.
protected  org.jboss.jms.jndi.JMSProviderAdapter getJMSProviderAdapter()
          Return the JMSProviderAdapter that should be used.
protected  Method getOnMessage()
          Initialize the ON_MESSAGE reference.
 javax.ejb.TimerService getTimerService()
           
protected  void innerStop()
          Stop done from inside, we should not stop the exceptionListener in inner stop.
 Object localInvoke(Method method, Object[] args)
           
protected  String parseJndiSuffix(String jndiname, String defautSuffix)
          Parse the JNDI suffix from the given JNDI name.
 void start()
           
 void stop()
           
 
Methods inherited from class org.jboss.ejb3.EJBContainer
addEnvEntry, construct, createCallbackHandler, createEnvEntries, getBeanClass, getBeanClassName, getEjbLinkResolver, getEjbName, getEnc, getEnvEntryValue, getHandledCallbacks, getInitialContext, getInitialContextProperties, getManagedEntityManagerFactory, getObjectName, getPool, initializePool, invokeInit, invokeInit, invokePostActivate, invokePostConstruct, invokePreDestroy, invokePrePassivate, resolveInjectors, setEjbLinkResolver, setManagedEntityManagerFactory
 
Methods inherited from class org.jboss.aop.ClassContainer
addClassMetaData, bindClassMetaData, createConstructorTables, createInterceptorChains, createMethodMap, initializeClassContainer, initializeMetadata, initializeMethodChain, rebindClassMetaData, rebuildInterceptors, removeClassMetaData, setClass
 
Methods inherited from class org.jboss.aop.Advisor
addAdviceInterceptor, addInterfaceIntroduction, addPerClassAspect, addPerInstanceAspect, addPerInstanceJoinpointAspect, applyPrecedence, createInterceptorChain, deployAnnotationOverrides, deployMethodAnnotationOverrides, dynamicInvoke, finalizeConstructionChain, finalizeConstructorChain, finalizeMethodChain, getAdviceInterceptor, getAnnotations, getClassMetaData, getClassMetadataBindings, getClazz, getConstructionInterceptors, getConstructorInterceptors, getConstructorMetaData, getConstructors, getDefaultMetaData, getFieldMetaData, getInterfaceIntroductions, getManager, getMethodInfo, getMethodMetaData, getName, getPerClassAspect, getPerClassAspect, getPerInstanceAspectDefinitions, getPerInstanceJoinpointAspectDefinitions, hasAnnotation, hasAnnotation, hasAnnotation, hasAnnotation, hasAnnotation, hasAnnotation, hasAnnotation, hasAnnotation, hasAnnotation, hasAspects, initializeConstructionChain, initializeConstructorChain, newBindingAdded, removeAdviceBinding, removeAdviceBindings, removeInterfaceIntroduction, removePerClassAspect, removePerInstanceAspect, removePerInstanceJoinpointAspect, resolveAnnotation, resolveAnnotation, resolveAnnotation, resolveAnnotation, resolveAnnotation, resolveConstructionPointcut, resolveConstructorPointcut, resolveMethodPointcut
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ON_MESSAGE

protected Method ON_MESSAGE

timerService

protected javax.ejb.TimerService timerService

activationSpec

protected ActivationSpec activationSpec

isContainerManagedTx

protected boolean isContainerManagedTx

acknowledgeMode

protected AcknowledgementMode acknowledgeMode

isNotSupportedTx

protected boolean isNotSupportedTx

connection

protected javax.jms.Connection connection

connectionConsumer

protected javax.jms.ConnectionConsumer connectionConsumer

serverSessionPool

protected javax.jms.ServerSessionPool serverSessionPool

config

protected MDBConfig config

exListener

protected org.jboss.ejb3.mdb.MDB.ExceptionListenerImpl exListener

dlqHandler

protected DLQHandler dlqHandler

getServerSessionPool

protected Method getServerSessionPool
This is needed because API changed from JBoss 4.0.1sp1 to 4.0.2 TODO remove this after 4.0.2 is out.


DEFAULT_DESTINATION_TYPE

protected static final String DEFAULT_DESTINATION_TYPE
Default destination type. Used when no message-driven-destination is given in ejb-jar, and a lookup of destinationJNDI from jboss.xml is not successfull. Default value: javax.jms.Topic.

See Also:
Constant Field Values
Constructor Detail

MDB

public MDB(String ejbName,
           org.jboss.aop.AspectManager manager,
           ClassLoader cl,
           String beanClassName,
           Hashtable ctxProperties)
Method Detail

create

public void create()
            throws Exception
Initialize the container invoker. Sets up a connection, a server session pool and a connection consumer for the configured destination.

Any JMSExceptions produced while initializing will be assumed to be caused due to JMS Provider failure.

Specified by:
create in interface Container
Overrides:
create in class EJBContainer
Throws:
Exception - Failed to initalize.

start

public void start()
           throws Exception
Specified by:
start in interface Container
Overrides:
start in class EJBContainer
Throws:
Exception

createSessionPool

protected javax.jms.ServerSessionPool createSessionPool(javax.jms.Destination dest,
                                                        javax.jms.Connection connection,
                                                        boolean isTransacted,
                                                        int ack,
                                                        javax.jms.MessageListener listener)
                                                 throws NamingException,
                                                        javax.jms.JMSException
Create a server session pool for the given connection.

Parameters:
connection - The connection to use.
minSession - The minumum number of sessions
maxSession - The maximum number of sessions.
keepAlive - The time to keep sessions alive
isTransacted - True if the sessions are transacted.
ack - The session acknowledgement mode.
listener - The message listener.
Returns:
A server session pool.
Throws:
javax.jms.JMSException
NamingException - Description of Exception

createDestination

protected javax.jms.Destination createDestination(Class type,
                                                  Context ctx,
                                                  String jndiName,
                                                  String jndiSuffix)
                                           throws Exception
Create and or lookup a JMS destination.

Parameters:
type - Either javax.jms.Queue or javax.jms.Topic.
ctx - The naming context to lookup destinations from.
jndiName - The name to use when looking up destinations.
jndiSuffix - The name to use when creating destinations.
Returns:
The destination.
Throws:
IllegalArgumentException - Type is not Queue or Topic.
Exception - Description of Exception

parseJndiSuffix

protected String parseJndiSuffix(String jndiname,
                                 String defautSuffix)
Parse the JNDI suffix from the given JNDI name.

Parameters:
jndiname - The JNDI name used to lookup the destination.
defautSuffix - Description of Parameter
Returns:
The parsed suffix or the defaultSuffix

getJMSProviderAdapter

protected org.jboss.jms.jndi.JMSProviderAdapter getJMSProviderAdapter()
                                                               throws NamingException
Return the JMSProviderAdapter that should be used.

Returns:
The JMSProviderAdapter to use.
Throws:
NamingException

getDestinationType

protected String getDestinationType(Context ctx,
                                    String destinationJNDI)
Try to get a destination type by looking up the destination JNDI, or provide a default if there is not destinationJNDI or if it is not possible to lookup.

Parameters:
ctx - The naming context to lookup destinations from.
destinationJNDI - The name to use when looking up destinations.
Returns:
The destination type, either derived from destinationJDNI or DEFAULT_DESTINATION_TYPE

getOnMessage

protected Method getOnMessage()
Initialize the ON_MESSAGE reference.


localInvoke

public Object localInvoke(Method method,
                          Object[] args)
                   throws Throwable
Throws:
Throwable

getTimerService

public javax.ejb.TimerService getTimerService()
Specified by:
getTimerService in interface Container

callTimeout

public void callTimeout(javax.ejb.Timer timer)
                 throws Exception
Specified by:
callTimeout in interface org.jboss.ejb.txtimer.TimedObjectInvoker
Throws:
Exception

innerStop

protected void innerStop()
Stop done from inside, we should not stop the exceptionListener in inner stop.


stop

public void stop()
          throws Exception
Specified by:
stop in interface Container
Overrides:
stop in class EJBContainer
Throws:
Exception

destroy

public void destroy()
             throws Exception
Specified by:
destroy in interface Container
Overrides:
destroy in class EJBContainer
Throws:
Exception


Copyright © 2002 JBoss Group, LLC. All Rights Reserved.