站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JBoss 3.2.7 server API Documentation 英文版文档

JMSContainerInvoker (JBoss Server API) - JBoss 3.2.7 server API Documentation 英文版文档


org.jboss.ejb.plugins.jms
Class JMSContainerInvoker

java.lang.Object
  extended byorg.jboss.mx.util.JBossNotificationBroadcasterSupport
      extended byorg.jboss.system.ServiceMBeanSupport
          extended byorg.jboss.ejb.plugins.jms.JMSContainerInvoker
All Implemented Interfaces:
ContainerPlugin, EJBProxyFactory, GenericEntityObjectFactory, JMSContainerInvokerMBean, javax.management.MBeanRegistration, javax.management.NotificationBroadcaster, javax.management.NotificationEmitter, org.jboss.system.Service, org.jboss.system.ServiceMBean

public class JMSContainerInvoker
extends org.jboss.system.ServiceMBeanSupport
implements EJBProxyFactory, JMSContainerInvokerMBean

EJBProxyFactory for JMS MessageDrivenBeans

Version:
$Revision: 1.50.2.20 $
Author:
Peter Antman ., Rickard 脰berg, Sebastien Alborini, Marc Fleury, Jason Dillon

Nested Class Summary
 
Nested classes inherited from class org.jboss.ejb.GenericEntityObjectFactory
GenericEntityObjectFactory.UTIL
 
Field Summary
protected  int acknowledgeMode
          JMS acknowledge mode, used when session is not XA.
protected  javax.jms.Connection connection
          The JMS connection.
protected  javax.jms.ConnectionConsumer connectionConsumer
          The JMS connection consumer.
protected  Container container
          The container.
protected static String DEFAULT_DESTINATION_TYPE
          Default destination type.
protected  boolean deliveryActive
           
protected  Element dlqConfig
          DLQConfig element from MDBConfig element from jboss.xml.
protected  DLQHandler dlqHandler
          Dead letter queue handler.
protected  org.jboss.ejb.plugins.jms.JMSContainerInvoker.ExceptionListenerImpl exListener
           
protected  String invokerBinding
           
protected  InvokerProxyBindingMetaData invokerMetaData
           
protected  boolean isContainerManagedTx
           
protected  boolean isNotSupportedTx
           
protected  long keepAlive
          Keep alive server sessions.
protected  int maxMessagesNr
          Maximum number provider is allowed to stuff into a session.
protected  int maxPoolSize
          Maximun pool size of server sessions.
protected  int minPoolSize
          Minimun pool size of server sessions.
protected static Method ON_MESSAGE
          MessageListener.onMessage(javax.jms.Message) reference.
protected  boolean optimize
           
protected  javax.jms.ServerSessionPool pool
           
protected  String providerAdapterJNDI
          JNDI name of the provider adapter.
protected  long reconnectInterval
          Time to wait before retrying to reconnect a lost connection.
protected  String serverSessionPoolFactoryJNDI
          JNDI name of the server session factory.
protected  TransactionManager tm
           
protected  boolean useDLQ
          If Dead letter queue should be used or not.
 
Fields inherited from class org.jboss.system.ServiceMBeanSupport
server, SERVICE_CONTROLLER_SIG, serviceName
 
Fields inherited from interface org.jboss.system.ServiceMBean
CREATE_EVENT, CREATED, DESTROY_EVENT, DESTROYED, FAILED, REGISTERED, START_EVENT, STARTED, STARTING, states, STOP_EVENT, STOPPED, STOPPING, UNREGISTERED
 
Constructor Summary
JMSContainerInvoker()
           
 
Method Summary
protected  javax.jms.Destination createDestination(Class type, Context ctx, String jndiName, String jndiSuffix)
          Create and or lookup a JMS destination.
protected  void createService()
          Initialize the container invoker.
protected  javax.jms.ServerSessionPool createSessionPool(javax.jms.Connection connection, int minSession, int maxSession, long keepAlive, boolean isTransacted, int ack, javax.jms.MessageListener listener)
          Create a server session pool for the given connection.
 boolean getDeliveryActive()
           
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.
 Object getEJBHome()
          Always throws an Error
 javax.ejb.EJBMetaData getEJBMetaData()
          Always throws an Error
 Collection getEntityCollection(Collection ids)
          Always throws an Error
 Object getEntityEJBObject(Object id)
          Always throws an Error
protected  JMSProviderAdapter getJMSProviderAdapter()
          Return the JMSProviderAdapter that should be used.
 long getKeepAliveMillis()
           
 int getMaxMessages()
           
 int getMaxPoolSize()
           
 MessageDrivenMetaData getMetaData()
           
 int getMinPoolSize()
           
 Object getStatefulSessionEJBObject(Object id)
          Always throws an Error
 Object getStatelessSessionEJBObject()
          Always throws an Error
 void importXml(Element element)
          XmlLoadable implementation.
protected  void innerStop()
          Stop done from inside, we should not stop the exceptionListener in inner stop.
 Object invoke(Object id, Method m, Object[] args, Transaction tx, Principal identity, Object credential)
           
 boolean isOptimized()
          Gets the Optimized attribute of the JMSContainerInvoker object
protected  String parseJndiSuffix(String jndiname, String defautSuffix)
          Parse the JNDI suffix from the given JNDI name.
 void restartDelivery()
           
 void setContainer(Container container)
          Set the container for which this is an invoker to.
 void setInvokerBinding(String binding)
          Set the invoker jndi binding
 void setInvokerMetaData(InvokerProxyBindingMetaData imd)
          Set the invoker meta data so that the ProxyFactory can initialize properly
 void setKeepAliveMillis(long keepAlive)
           
 void setMaxMessages(int maxMessages)
           
 void setMaxPoolSize(int maxPoolSize)
           
 void setMinPoolSize(int minPoolSize)
           
 void setOptimized(boolean optimize)
          Sets the Optimized attribute of the JMSContainerInvoker object
 void startDelivery()
           
protected  void startService()
           
 void stopDelivery()
           
protected  void stopService()
           
 String toString()
          Return a string representation of the current config state.
 
Methods inherited from class org.jboss.system.ServiceMBeanSupport
create, destroy, destroyService, getLog, getName, getNextNotificationSequenceNumber, getObjectName, getServer, getServiceName, getState, getStateString, jbossInternalCreate, jbossInternalDescription, jbossInternalDestroy, jbossInternalLifecycle, jbossInternalStart, jbossInternalStop, postDeregister, postRegister, preDeregister, preRegister, start, stop
 
Methods inherited from class org.jboss.mx.util.JBossNotificationBroadcasterSupport
addNotificationListener, getNotificationInfo, handleNotification, removeNotificationListener, removeNotificationListener, sendNotification
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.jboss.system.Service
create, destroy, start, stop
 
Methods inherited from interface org.jboss.system.ServiceMBean
getName, getState, getStateString, jbossInternalLifecycle
 

Field Detail

ON_MESSAGE

protected static Method ON_MESSAGE
MessageListener.onMessage(javax.jms.Message) reference.


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

optimize

protected boolean optimize

maxMessagesNr

protected int maxMessagesNr
Maximum number provider is allowed to stuff into a session.


minPoolSize

protected int minPoolSize
Minimun pool size of server sessions.


maxPoolSize

protected int maxPoolSize
Maximun pool size of server sessions.


keepAlive

protected long keepAlive
Keep alive server sessions.


reconnectInterval

protected long reconnectInterval
Time to wait before retrying to reconnect a lost connection.


useDLQ

protected boolean useDLQ
If Dead letter queue should be used or not.


providerAdapterJNDI

protected String providerAdapterJNDI
JNDI name of the provider adapter.

See Also:
JMSProviderAdapter

serverSessionPoolFactoryJNDI

protected String serverSessionPoolFactoryJNDI
JNDI name of the server session factory.

See Also:
ServerSessionPoolFactory

acknowledgeMode

protected int acknowledgeMode
JMS acknowledge mode, used when session is not XA.


isContainerManagedTx

protected boolean isContainerManagedTx

isNotSupportedTx

protected boolean isNotSupportedTx

container

protected Container container
The container.


connection

protected javax.jms.Connection connection
The JMS connection.


connectionConsumer

protected javax.jms.ConnectionConsumer connectionConsumer
The JMS connection consumer.


tm

protected TransactionManager tm

pool

protected javax.jms.ServerSessionPool pool

exListener

protected org.jboss.ejb.plugins.jms.JMSContainerInvoker.ExceptionListenerImpl exListener

dlqHandler

protected DLQHandler dlqHandler
Dead letter queue handler.


dlqConfig

protected Element dlqConfig
DLQConfig element from MDBConfig element from jboss.xml.


invokerMetaData

protected InvokerProxyBindingMetaData invokerMetaData

invokerBinding

protected String invokerBinding

deliveryActive

protected boolean deliveryActive
Constructor Detail

JMSContainerInvoker

public JMSContainerInvoker()
Method Detail

setInvokerMetaData

public void setInvokerMetaData(InvokerProxyBindingMetaData imd)
Set the invoker meta data so that the ProxyFactory can initialize properly

Specified by:
setInvokerMetaData in interface EJBProxyFactory

setInvokerBinding

public void setInvokerBinding(String binding)
Set the invoker jndi binding

Specified by:
setInvokerBinding in interface EJBProxyFactory

setContainer

public void setContainer(Container container)
Set the container for which this is an invoker to.

Specified by:
setContainer in interface ContainerPlugin
Parameters:
container - The container for which this is an invoker to.

getMinPoolSize

public int getMinPoolSize()
Specified by:
getMinPoolSize in interface JMSContainerInvokerMBean

setMinPoolSize

public void setMinPoolSize(int minPoolSize)
Specified by:
setMinPoolSize in interface JMSContainerInvokerMBean

getMaxPoolSize

public int getMaxPoolSize()
Specified by:
getMaxPoolSize in interface JMSContainerInvokerMBean

setMaxPoolSize

public void setMaxPoolSize(int maxPoolSize)
Specified by:
setMaxPoolSize in interface JMSContainerInvokerMBean

getKeepAliveMillis

public long getKeepAliveMillis()
Specified by:
getKeepAliveMillis in interface JMSContainerInvokerMBean

setKeepAliveMillis

public void setKeepAliveMillis(long keepAlive)
Specified by:
setKeepAliveMillis in interface JMSContainerInvokerMBean

getMaxMessages

public int getMaxMessages()
Specified by:
getMaxMessages in interface JMSContainerInvokerMBean

setMaxMessages

public void setMaxMessages(int maxMessages)
Specified by:
setMaxMessages in interface JMSContainerInvokerMBean

getMetaData

public MessageDrivenMetaData getMetaData()
Specified by:
getMetaData in interface JMSContainerInvokerMBean

getDeliveryActive

public boolean getDeliveryActive()
Specified by:
getDeliveryActive in interface JMSContainerInvokerMBean
Returns:
whether delivery is active

startDelivery

public void startDelivery()
                   throws Exception
Specified by:
startDelivery in interface JMSContainerInvokerMBean
Throws:
Exception

stopDelivery

public void stopDelivery()
                  throws Exception
Specified by:
stopDelivery in interface JMSContainerInvokerMBean
Throws:
Exception

restartDelivery

public void restartDelivery()
                     throws Exception
Specified by:
restartDelivery in interface JMSContainerInvokerMBean
Throws:
Exception

setOptimized

public void setOptimized(boolean optimize)
Sets the Optimized attribute of the JMSContainerInvoker object

Parameters:
optimize - The new Optimized value

getEJBHome

public Object getEJBHome()
Always throws an Error

Specified by:
getEJBHome in interface EJBProxyFactory
Returns:
An implementation of the home interface for this container.
Throws:
Error - Not valid for MDB

getEJBMetaData

public javax.ejb.EJBMetaData getEJBMetaData()
Always throws an Error

Specified by:
getEJBMetaData in interface EJBProxyFactory
Returns:
An implementation of the EJBMetaData interface.
Throws:
Error - Not valid for MDB

getEntityCollection

public Collection getEntityCollection(Collection ids)
Always throws an Error

Specified by:
getEntityCollection in interface EJBProxyFactory
Parameters:
ids - Enumeration of primary keys.
Returns:
A collection of EJBObjects implementing the remote interface for this container.
Throws:
Error - Not valid for MDB

getEntityEJBObject

public Object getEntityEJBObject(Object id)
Always throws an Error

Specified by:
getEntityEJBObject in interface EJBProxyFactory
Parameters:
id - The primary key of the entity.
Returns:
An implementation of the remote interface for this container.
Throws:
Error - Not valid for MDB

getStatefulSessionEJBObject

public Object getStatefulSessionEJBObject(Object id)
Always throws an Error

Specified by:
getStatefulSessionEJBObject in interface EJBProxyFactory
Parameters:
id - The id of the session.
Returns:
An implementation of the remote interface for this container.
Throws:
Error - Not valid for MDB

getStatelessSessionEJBObject

public Object getStatelessSessionEJBObject()
Always throws an Error

Specified by:
getStatelessSessionEJBObject in interface EJBProxyFactory
Returns:
An implementation of the remote interface for this container.
Throws:
Error - Not valid for MDB

isOptimized

public boolean isOptimized()
Gets the Optimized attribute of the JMSContainerInvoker object

Returns:
The Optimized value

importXml

public void importXml(Element element)
               throws Exception
XmlLoadable implementation. FIXME - we ought to move all config into MDBConfig, but I do not do that now due to backward compatibility.

Parameters:
element - Description of Parameter
Throws:
org.jboss.deployment.DeploymentException - Description of Exception
Exception

createService

protected void createService()
                      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.

Throws:
Exception - Failed to initalize.

startService

protected void startService()
                     throws Exception
Throws:
Exception

stopService

protected void stopService()
                    throws Exception
Throws:
Exception

innerStop

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


invoke

public Object invoke(Object id,
                     Method m,
                     Object[] args,
                     Transaction tx,
                     Principal identity,
                     Object credential)
              throws Exception
Throws:
Exception

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

getJMSProviderAdapter

protected JMSProviderAdapter getJMSProviderAdapter()
                                            throws NamingException
Return the JMSProviderAdapter that should be used.

Returns:
The JMSProviderAdapter to use.
Throws:
NamingException

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

createSessionPool

protected javax.jms.ServerSessionPool createSessionPool(javax.jms.Connection connection,
                                                        int minSession,
                                                        int maxSession,
                                                        long keepAlive,
                                                        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

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

toString

public String toString()
Return a string representation of the current config state.



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