FileDocCategorySizeDatePackage
MDB.javaAPI DocJBoss 4.2.16629Fri Jul 13 20:53:56 BST 2007org.jboss.ejb3.mdb

MDB

public class MDB extends MessagingContainer
Comment
author
Bill Burke
version
$Revision: 61201 $

Fields Summary
private static final Logger
log
protected Class
messagingType
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.
Constructors Summary
public MDB(String ejbName, org.jboss.aop.AspectManager manager, ClassLoader cl, String beanClassName, Hashtable ctxProperties, org.jboss.ejb3.interceptor.InterceptorInfoRepository interceptorRepository, Ejb3Deployment deployment)


             
                 
   
      super(ejbName, manager, cl, beanClassName, ctxProperties, interceptorRepository, deployment);
   
Methods Summary
public java.util.MapgetActivationConfigProperties()

      HashMap result = new HashMap();
      MessageDriven mdAnnotation = (MessageDriven) resolveAnnotation(MessageDriven.class);
      for (ActivationConfigProperty property : mdAnnotation.activationConfig())
      {
         addActivationSpecProperty(result, property);
      }
      
      DefaultActivationSpecs defaultSpecsAnnotation = (DefaultActivationSpecs)resolveAnnotation(DefaultActivationSpecs.class);
      if (defaultSpecsAnnotation != null)
      {
         for (ActivationConfigProperty property : defaultSpecsAnnotation.value())
         {
            addActivationSpecProperty(result, property);
         }
      }
      
      return result;
   
public javax.management.ObjectNamegetJmxName()

      ObjectName jmxName = null;
      String jndiName = ProxyFactoryHelper.getLocalJndiName(this);
      // The name must be escaped since the jndiName may be arbitrary
      String name = org.jboss.ejb.Container.BASE_EJB_CONTAINER_NAME + ",jndiName=" + jndiName;
      try
      {
         jmxName = org.jboss.mx.util.ObjectNameConverter.convert(name);
      }
      catch (MalformedObjectNameException e)
      {
         e.printStackTrace();
         throw new RuntimeException("Failed to create ObjectName, msg=" + e.getMessage());
      }

      return jmxName;
   
public intgetKeepAliveMillis()

      String keepAlive = activationSpec.get("keepAlive");
      if (keepAlive != null) 
         return Integer.parseInt(keepAlive);
      else
         return 60000;
   
public intgetMaxMessages()

      String maxMessages = activationSpec.get("maxMessages");
      if (maxMessages != null) 
         return Integer.parseInt(maxMessages);
      else
         return 1;
   
public intgetMaxPoolSize()

      String maxSession = activationSpec.get("maxSession");
      if (maxSession != null) 
         return Integer.parseInt(maxSession);
      else
         return 15;
   
public java.lang.ClassgetMessagingType()

      if (messagingType == null)
      {
         MessageDriven annotation = (MessageDriven) resolveAnnotation(MessageDriven.class);
         messagingType = annotation.messageListenerInterface();
         if (messagingType.getName().equals(Object.class.getName()))
         {
            ArrayList<Class> list = ProxyFactoryHelper.getBusinessInterfaces(clazz);
            if (list.size() > 1 || list.size() == 0) throw new RuntimeException("unable to determine messagingType interface for MDB");
            messagingType = list.get(0);
         }
      }

      return messagingType;
   
public org.jboss.aop.MethodInfogetMethodInfo(java.lang.reflect.Method method)

      long hash = MethodHashing.calculateHash(method);
      MethodInfo info = (MethodInfo) methodInterceptors.get(hash);
      return info;
   
public intgetMinPoolSize()

      String minSession = activationSpec.get("minSession");
      if (minSession != null) 
         return Integer.parseInt(minSession);
      else
         return 1;
   
protected voidpopulateActivationSpec()

      DefaultActivationSpecs defaultSpecs = (DefaultActivationSpecs) resolveAnnotation(DefaultActivationSpecs.class);
      if (defaultSpecs != null)
      {
         activationSpec.merge(defaultSpecs.value());
      }

      MessageDriven md = (MessageDriven) resolveAnnotation(MessageDriven.class);

      activationSpec.merge(md.activationConfig());
   
public voidstart()

      super.start();