[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins/jms JMSContainerInvoker.java
User: chirino Date: 02/01/17 09:18:31 Modified:src/main/org/jboss/ejb/plugins/jms JMSContainerInvoker.java Log: Enhanced so that the MDB deploys even if the JMS provider is not running when it gets deployed. It will jump into recovery thread that trys to re-establish it's connection to the JMS provider. Revision ChangesPath 1.42 +34 -10 jboss/src/main/org/jboss/ejb/plugins/jms/JMSContainerInvoker.java Index: JMSContainerInvoker.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/jms/JMSContainerInvoker.java,v retrieving revision 1.41 retrieving revision 1.42 diff -u -r1.41 -r1.42 --- JMSContainerInvoker.java 2002/01/08 22:27:15 1.41 +++ JMSContainerInvoker.java 2002/01/17 17:18:30 1.42 @@ -56,7 +56,7 @@ * /a * @authora href=mailto:[EMAIL PROTECTED];Marc Fleury/a * @authora href=mailto:[EMAIL PROTECTED];Jason Dillon/a - * @version $Revision: 1.41 $ + * @version $Revision: 1.42 $ */ public class JMSContainerInvoker implements ContainerInvoker, XmlLoadable @@ -399,6 +399,29 @@ serverSessionPoolFactoryJNDI = java:/ + serverSessionPoolFactoryJNDI; } } + + /** +* 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. +*/ + public void create() throws Exception { + exListener = new ExceptionListenerImpl(this); + try { + innerCreate(); + } catch ( final JMSException e ) { + // start a thread up to handle recovering the connection. + new Thread() { + public void run() { + exListener.onException(e); + } + }.start(); + } + } /** * Initialize the container invoker. Sets up a connection, a server session @@ -406,7 +429,7 @@ * * @throws Exception Failed to initalize. */ - public void create() throws Exception + public void innerCreate() throws Exception { boolean debug = log.isDebugEnabled(); @@ -631,9 +654,10 @@ { if (log.isDebugEnabled()) log.debug(Starting JMSContainerInvoker for bean + beanName); - exListener = new ExceptionListenerImpl(this); - connection.setExceptionListener(exListener); - connection.start(); + if( connection != null ) { + connection.setExceptionListener(exListener); + connection.start(); + } } /** @@ -1010,11 +1034,11 @@ { currentThread = Thread.currentThread(); - log.warn(MDB lost connection to provider, ex); + log.warn(JMS provider failure detected: , ex); boolean tryIt = true; while (tryIt notStoped) { -log.info(MDB Trying to reconnect...); +log.info(Trying to reconnect to JMS provider); try { try @@ -1030,14 +1054,14 @@ // Reboot container invoker.innerStop(); invoker.destroy(); - invoker.create(); + invoker.innerCreate(); invoker.start(); tryIt = false; - log.info(OK - reconnected); + log.info(Reconnected to JMS provider); } catch (Exception e) { - log.error(MDB error reconnecting, e); + log.error(Reconnect failed: JMS provider failure detected:, e); } } currentThread = null; ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins/jms JMSContainerInvoker.java
User: chirino Date: 02/01/08 14:27:15 Modified:src/main/org/jboss/ejb/plugins/jms JMSContainerInvoker.java Log: I now look for a mdb-subscription-id element in jboss.xml to tell what the durable subsctiption id is. It used to be placed in the mdb-client-id element, but that was incorrect as the clientId and subscriptionId fields do not have to match. Revision ChangesPath 1.41 +2 -3 jboss/src/main/org/jboss/ejb/plugins/jms/JMSContainerInvoker.java Index: JMSContainerInvoker.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/jms/JMSContainerInvoker.java,v retrieving revision 1.40 retrieving revision 1.41 diff -u -r1.40 -r1.41 --- JMSContainerInvoker.java 2002/01/07 20:54:19 1.40 +++ JMSContainerInvoker.java 2002/01/08 22:27:15 1.41 @@ -56,7 +56,7 @@ * /a * @authora href=mailto:[EMAIL PROTECTED];Marc Fleury/a * @authora href=mailto:[EMAIL PROTECTED];Jason Dillon/a - * @version $Revision: 1.40 $ + * @version $Revision: 1.41 $ */ public class JMSContainerInvoker implements ContainerInvoker, XmlLoadable @@ -529,8 +529,7 @@ else { //Durable subscription -String durableName = -clientId != null ? clientId : config.getEjbName(); +String durableName = config.getSubscriptionId(); connectionConsumer = tConnection.createDurableConnectionConsumer(topic, ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins/jms JMSContainerInvoker.java
User: ejort Date: 02/01/03 09:09:40 Modified:src/main/org/jboss/ejb/plugins/jms JMSContainerInvoker.java Log: Correct a changed object name. Revision ChangesPath 1.38 +2 -2 jboss/src/main/org/jboss/ejb/plugins/jms/JMSContainerInvoker.java Index: JMSContainerInvoker.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/jms/JMSContainerInvoker.java,v retrieving revision 1.37 retrieving revision 1.38 diff -u -r1.37 -r1.38 --- JMSContainerInvoker.java 2001/12/19 08:20:28 1.37 +++ JMSContainerInvoker.java 2002/01/03 17:09:39 1.38 @@ -55,7 +55,7 @@ * /a * @authora href=mailto:[EMAIL PROTECTED];Marc Fleury/a * @authora href=mailto:[EMAIL PROTECTED];Jason Dillon/a -* @version $Revision: 1.37 $ +* @version $Revision: 1.38 $ */ public class JMSContainerInvoker @@ -753,7 +753,7 @@ } // invoke the server to create the destination - server.invoke(new ObjectName(JBossMQ, service, Server), + server.invoke(new ObjectName(jboss.mq, service, Server), methodName, new Object[]{jndiSuffix}, new String[]{java.lang.String}); ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins/jms JMSContainerInvoker.java
User: mnf999 Date: 01/12/19 00:20:28 Modified:src/main/org/jboss/ejb/plugins/jms JMSContainerInvoker.java Log: Revision ChangesPath 1.37 +16 -9 jboss/src/main/org/jboss/ejb/plugins/jms/JMSContainerInvoker.java Index: JMSContainerInvoker.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/jms/JMSContainerInvoker.java,v retrieving revision 1.36 retrieving revision 1.37 diff -u -r1.36 -r1.37 --- JMSContainerInvoker.java 2001/12/19 05:58:00 1.36 +++ JMSContainerInvoker.java 2001/12/19 08:20:28 1.37 @@ -51,15 +51,13 @@ * * @authora href=mailto:[EMAIL PROTECTED];Peter Antman/a . * @authora href=mailto:[EMAIL PROTECTED];Rickard Öberg/a -* @authora href=mailto:[EMAIL PROTECTED];Sebastien Alborini /a +* @authora href=mailto:[EMAIL PROTECTED];Sebastien Alborini +* /a * @authora href=mailto:[EMAIL PROTECTED];Marc Fleury/a * @authora href=mailto:[EMAIL PROTECTED];Jason Dillon/a -* @version $Revision: 1.36 $ -* pb20011219 marc fleury/b -* ul -* li use of the container invoker here is silly and a good example of why the proxy generation is not mixed with invokers now -*/ul +* @version $Revision: 1.37 $ */ + public class JMSContainerInvoker implements ContainerInvoker, XmlLoadable { @@ -199,12 +197,13 @@ // ContainerInvoker implementation - /** +/* * Gets the EJBHome attribute of the JMSContainerInvoker object * * @return The EJBHome value */ public Object getEJBHome() + { throw new Error(Not valid for MessageDriven beans); } @@ -237,6 +236,7 @@ * @returnThe EntityEJBObject value */ public Object getEntityEJBObject(Object id) + { throw new Error(Not valid for MessageDriven beans); } @@ -249,17 +249,20 @@ * @returnThe StatefulSessionEJBObject value */ public Object getStatefulSessionEJBObject(Object id) + { throw new Error(Not valid for MessageDriven beans); } /** + * Gets the StatelessSessionEJBObject attribute of the JMSContainerInvoker * object * * @return The StatelessSessionEJBObject value */ public Object getStatelessSessionEJBObject() + { throw new Error(Not valid for MessageDriven beans); } @@ -392,7 +395,7 @@ { serverSessionPoolFactoryJNDI = java:/ + serverSessionPoolFactoryJNDI; } - + } @@ -404,15 +407,18 @@ * @throws Exception Failed to initalize. */ public void create() throws Exception + { log.debug(initializing); // Set up Dead Letter Queue handler if (useDLQ) { + dlqHandler = new DLQHandler(); - dlqHandler.importXml(mdbConfig); + dlqHandler.importXml(dlqConfig); dlqHandler.create(); + } // Store TM reference locally - should we test for CMT Required @@ -584,9 +590,10 @@ Object credential) throws Exception { + Invocation mi = new Invocation(id, m, args, tx, identity, credential); - + // Set the right context classloader ClassLoader oldCl = Thread.currentThread().getContextClassLoader(); Thread.currentThread().setContextClassLoader(container.getClassLoader()); ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins/jms JMSContainerInvoker.java
User: mnf999 Date: 01/12/18 21:58:00 Modified:src/main/org/jboss/ejb/plugins/jms JMSContainerInvoker.java Log: Revision ChangesPath 1.36 +434 -426 jboss/src/main/org/jboss/ejb/plugins/jms/JMSContainerInvoker.java Index: JMSContainerInvoker.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/jms/JMSContainerInvoker.java,v retrieving revision 1.35 retrieving revision 1.36 diff -u -r1.35 -r1.36 --- JMSContainerInvoker.java 2001/12/13 13:25:32 1.35 +++ JMSContainerInvoker.java 2001/12/19 05:58:00 1.36 @@ -1,15 +1,16 @@ /* - * JBoss, the OpenSource J2EE webOS - * - * Distributable under LGPL license. - * See terms of license at gnu.org. - */ +* JBoss, the OpenSource J2EE webOS +* +* Distributable under LGPL license. +* See terms of license at gnu.org. +*/ package org.jboss.ejb.plugins.jms; import java.lang.reflect.Method; import java.security.Principal; import java.util.Collection; import java.util.Hashtable; + import javax.ejb.EJBHome; import javax.ejb.EJBMetaData; import javax.ejb.EJBObject; @@ -30,7 +31,10 @@ import org.jboss.deployment.DeploymentException; import org.jboss.ejb.Container; import org.jboss.ejb.ContainerInvoker; -import org.jboss.ejb.MethodInvocation; + +import org.jboss.deployment.DeploymentException; +import org.jboss.invocation.Invocation; + import org.jboss.logging.Logger; import org.jboss.jms.ConnectionFactoryHelper; import org.jboss.jms.asf.ServerSessionPoolFactory; @@ -43,244 +47,247 @@ import org.w3c.dom.Element; import org.w3c.dom.Node; /** - * ContainerInvoker for JMS MessageDrivenBeans, based on JRMPContainerInvoker. - * - * @authora href=mailto:[EMAIL PROTECTED];Peter Antman/a . - * @authora href=mailto:[EMAIL PROTECTED];Rickard Öberg/a - * @authora href=mailto:[EMAIL PROTECTED];Sebastien Alborini - * /a - * @authora href=mailto:[EMAIL PROTECTED];Marc Fleury/a - * @authora href=mailto:[EMAIL PROTECTED];Jason Dillon/a - * @version $Revision: 1.35 $ - */ +* ContainerInvoker for JMS MessageDrivenBeans, based on JRMPContainerInvoker. +* +* @authora href=mailto:[EMAIL PROTECTED];Peter Antman/a . +* @authora href=mailto:[EMAIL PROTECTED];Rickard Öberg/a +* @authora href=mailto:[EMAIL PROTECTED];Sebastien Alborini /a +* @authora href=mailto:[EMAIL PROTECTED];Marc Fleury/a +* @authora href=mailto:[EMAIL PROTECTED];Jason Dillon/a +* @version $Revision: 1.36 $ +* pb20011219 marc fleury/b +* ul +* li use of the container invoker here is silly and a good example of why the proxy generation is not mixed with invokers now +*/ul +*/ public class JMSContainerInvoker - implements ContainerInvoker, XmlLoadable +implements ContainerInvoker, XmlLoadable { // Constants - - + /** -* {@link MessageListener#onMessage} reference. -*/ + * {@link MessageListener#onMessage} reference. + */ /* -* final -*/ + * final + */ protected static Method ON_MESSAGE; - + /** -* 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. -*/ + * 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. + */ protected final static String DEFAULT_DESTINATION_TYPE = javax.jms.Topic; - + // Attributes - + /** -* Description of the Field -*/ + * Description of the Field + */ protected boolean optimize; // = false; /** -* Maximu number provider is allowed to stuff into a session. -*/ + * Maximu number provider is allowed to stuff into a session. + */ protected int maxMessagesNr = 1; /** -* Maximun pool size of server sessions. -*/ + * Maximun pool size of server sessions. + */ protected int maxPoolSize = 15; /** -* Time to wait before retrying to reconnect a lost connection. -*/ + * Time to wait before retrying to reconnect a lost connection. + */ protected long reconnectInterval = 1; /** -* If Dead letter queue should be used or not. -*/ + * If Dead letter queue should be used or not. + */ protected boolean useDLQ = false; /** -* JNDI name of the provider adapter. -* @see org.jboss.jms.jndi.JMSProviderAdapter -*/ + * JNDI name of the provider adapter. + * @see
[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins/jms JMSContainerInvoker.java
User: starksm Date: 01/12/13 05:25:32 Modified:src/main/org/jboss/ejb/plugins/jms JMSContainerInvoker.java Log: Use JBoss Logger and trace level priority for onMessage Revision ChangesPath 1.35 +9 -14 jboss/src/main/org/jboss/ejb/plugins/jms/JMSContainerInvoker.java Index: JMSContainerInvoker.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/jms/JMSContainerInvoker.java,v retrieving revision 1.34 retrieving revision 1.35 diff -u -r1.34 -r1.35 --- JMSContainerInvoker.java 2001/12/11 09:45:54 1.34 +++ JMSContainerInvoker.java 2001/12/13 13:25:32 1.35 @@ -11,7 +11,6 @@ import java.util.Collection; import java.util.Hashtable; import javax.ejb.EJBHome; - import javax.ejb.EJBMetaData; import javax.ejb.EJBObject; @@ -22,28 +21,23 @@ import javax.management.ObjectName; import javax.naming.Context; import javax.naming.InitialContext; - import javax.naming.Name; import javax.naming.NamingException; import javax.transaction.Transaction; import javax.transaction.TransactionManager; -import org.apache.log4j.Category; +import org.jboss.deployment.DeploymentException; import org.jboss.ejb.Container; import org.jboss.ejb.ContainerInvoker; -import org.jboss.deployment.DeploymentException; import org.jboss.ejb.MethodInvocation; - +import org.jboss.logging.Logger; import org.jboss.jms.ConnectionFactoryHelper; import org.jboss.jms.asf.ServerSessionPoolFactory; - import org.jboss.jms.asf.StdServerSessionPool; - import org.jboss.jms.jndi.JMSProviderAdapter; import org.jboss.metadata.MessageDrivenMetaData; import org.jboss.metadata.MetaData; - import org.jboss.metadata.XmlLoadable; import org.w3c.dom.Element; @@ -57,7 +51,7 @@ * /a * @authora href=mailto:[EMAIL PROTECTED];Marc Fleury/a * @authora href=mailto:[EMAIL PROTECTED];Jason Dillon/a - * @version $Revision: 1.34 $ + * @version $Revision: 1.35 $ */ public class JMSContainerInvoker implements ContainerInvoker, XmlLoadable @@ -164,7 +158,7 @@ /** * Instance logger. */ - private final Category log = Category.getInstance(this.getClass()); + private final Logger log = Logger.getLogger(this.getClass()); // ContainerService implementation --- @@ -282,7 +276,8 @@ log.debug(Destroying JMSContainerInvoker for bean + beanName); // Take down DLQ - if ( dlqHandler != null) { + if ( dlqHandler != null) + { dlqHandler.destroy(); } @@ -907,7 +902,7 @@ { // assert message != null; - if (log.isDebugEnabled()) + if (log.isTraceEnabled()) { log.debug(processing message: + message); } @@ -923,7 +918,6 @@ id = JMSContainerInvoker; } - // Invoke, shuld we catch any Exceptions?? try { @@ -1032,7 +1026,8 @@ /** * Return a string representation of the current config state. */ - public String toString() { + public String toString() + { StringBuffer buff = new StringBuffer(); buff.append(JMSContainerInvoker: {); buff.append(beanName=).append(beanName); ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins/jms JMSContainerInvoker.java
User: starksm Date: 01/12/13 19:22:11 Modified:src/main/org/jboss/ejb/plugins/jms Tag: Branch_2_4 JMSContainerInvoker.java Log: Integrate changes from 3.0 to improve the MDB/ASF layer. This includes support for the dead message queue for repeated MDB.onMessage failures. Revision ChangesPath No revision No revision 1.12.4.6 +864 -518 jboss/src/main/org/jboss/ejb/plugins/jms/JMSContainerInvoker.java Index: JMSContainerInvoker.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/jms/JMSContainerInvoker.java,v retrieving revision 1.12.4.5 retrieving revision 1.12.4.6 diff -u -r1.12.4.5 -r1.12.4.6 --- JMSContainerInvoker.java 2001/11/10 04:48:13 1.12.4.5 +++ JMSContainerInvoker.java 2001/12/14 03:22:11 1.12.4.6 @@ -5,481 +5,594 @@ * See terms of license at gnu.org. */ package org.jboss.ejb.plugins.jms; - -import java.util.Collection; -import java.util.Hashtable; import java.lang.reflect.Method; import java.security.Principal; -import javax.jms.Connection; -import javax.jms.ConnectionConsumer; -import javax.jms.Destination; -import javax.jms.ExceptionListener; -import javax.jms.JMSException; -import javax.jms.Message; -import javax.jms.MessageListener; -import javax.jms.Queue; -import javax.jms.QueueConnection; -import javax.jms.ServerSessionPool; -import javax.jms.Topic; -import javax.jms.TopicConnection; +import java.util.Collection; +import java.util.Hashtable; +import javax.ejb.EJBHome; import javax.ejb.EJBMetaData; -import javax.ejb.EJBHome; import javax.ejb.EJBObject; -import javax.naming.Name; -import javax.naming.InitialContext; -import javax.naming.Context; -import javax.naming.NamingException; -import javax.naming.NameNotFoundException; - -import javax.transaction.Status; -import javax.transaction.Transaction; -import javax.transaction.TransactionManager; +import javax.jms.*; +import javax.management.MBeanServer; import javax.management.MBeanServerFactory; -import javax.management.MBeanServer; import javax.management.ObjectName; +import javax.naming.Context; +import javax.naming.InitialContext; -import org.w3c.dom.Element; +import javax.naming.Name; +import javax.naming.NamingException; -import org.apache.log4j.Category; +import javax.transaction.Transaction; +import javax.transaction.TransactionManager; -import org.jboss.jms.ConnectionFactoryHelper; -import org.jboss.ejb.MethodInvocation; +import org.jboss.deployment.DeploymentException; import org.jboss.ejb.Container; -import org.jboss.ejb.ContainerInvokerContainer; -import org.jboss.ejb.Interceptor; import org.jboss.ejb.ContainerInvoker; -import org.jboss.deployment.DeploymentException; -import org.jboss.metadata.XmlLoadable; -import org.jboss.metadata.MetaData; -import org.jboss.metadata.MessageDrivenMetaData; -import org.jboss.jms.jndi.JMSProviderAdapter; +import org.jboss.ejb.MethodInvocation; +import org.jboss.jms.ConnectionFactoryHelper; import org.jboss.jms.asf.ServerSessionPoolFactory; import org.jboss.jms.asf.StdServerSessionPool; +import org.jboss.jms.jndi.JMSProviderAdapter; +import org.jboss.logging.Logger; +import org.jboss.metadata.MessageDrivenMetaData; +import org.jboss.metadata.MetaData; +import org.jboss.metadata.XmlLoadable; +import org.w3c.dom.Element; +import org.w3c.dom.Node; /** * ContainerInvoker for JMS MessageDrivenBeans, based on JRMPContainerInvoker. * - * @author a href=mailto:[EMAIL PROTECTED];Peter Antman/a. - * @author a href=mailto:[EMAIL PROTECTED];Rickard Öberg/a - * @author a href=mailto:[EMAIL PROTECTED];Sebastien Alborini/a - * @author a href=mailto:[EMAIL PROTECTED];Marc Fleury/a - * @author a href=mailto:[EMAIL PROTECTED];Jason Dillon/a - * @version $Revision: 1.12.4.5 $ + * @authora href=mailto:[EMAIL PROTECTED];Peter Antman/a . + * @authora href=mailto:[EMAIL PROTECTED];Rickard Öberg/a + * @authora href=mailto:[EMAIL PROTECTED];Sebastien Alborini + * /a + * @authora href=mailto:[EMAIL PROTECTED];Marc Fleury/a + * @authora href=mailto:[EMAIL PROTECTED];Jason Dillon/a + * @version $Revision: 1.12.4.6 $ */ public class JMSContainerInvoker - implements ContainerInvoker, XmlLoadable + implements ContainerInvoker, XmlLoadable { // Constants - - - /** {@link MessageListener#onMessage} reference. */ - protected static /* final */ Method ON_MESSAGE; - + /** -* Initialize the ON_MESSAGE reference. +* {@link MessageListener#onMessage} reference. */ - static { - try { - final Class type = MessageListener.class; -
[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins/jms JMSContainerInvoker.java DLQHandler.java
User: pra Date: 01/12/11 01:45:55 Modified:src/main/org/jboss/ejb/plugins/jms JMSContainerInvoker.java DLQHandler.java Log: Added configurability of exception reconnect interval and if DQL should be used; also some doc and toString function Revision ChangesPath 1.34 +81 -24 jboss/src/main/org/jboss/ejb/plugins/jms/JMSContainerInvoker.java Index: JMSContainerInvoker.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/jms/JMSContainerInvoker.java,v retrieving revision 1.33 retrieving revision 1.34 diff -u -r1.33 -r1.34 --- JMSContainerInvoker.java 2001/11/26 03:12:28 1.33 +++ JMSContainerInvoker.java 2001/12/11 09:45:54 1.34 @@ -47,7 +47,7 @@ import org.jboss.metadata.XmlLoadable; import org.w3c.dom.Element; - +import org.w3c.dom.Node; /** * ContainerInvoker for JMS MessageDrivenBeans, based on JRMPContainerInvoker. * @@ -57,7 +57,7 @@ * /a * @authora href=mailto:[EMAIL PROTECTED];Marc Fleury/a * @authora href=mailto:[EMAIL PROTECTED];Jason Dillon/a - * @version $Revision: 1.33 $ + * @version $Revision: 1.34 $ */ public class JMSContainerInvoker implements ContainerInvoker, XmlLoadable @@ -87,27 +87,37 @@ protected boolean optimize; // = false; /** -* Description of the Field +* Maximu number provider is allowed to stuff into a session. */ protected int maxMessagesNr = 1; /** -* Description of the Field +* Maximun pool size of server sessions. */ protected int maxPoolSize = 15; /** -* Description of the Field +* Time to wait before retrying to reconnect a lost connection. +*/ + protected long reconnectInterval = 1; + /** +* If Dead letter queue should be used or not. +*/ + protected boolean useDLQ = false; + /** +* JNDI name of the provider adapter. +* @see org.jboss.jms.jndi.JMSProviderAdapter */ protected String providerAdapterJNDI; /** -* Description of the Field +* JNDI name of the server session factory. +* @see org.jboss.jms.asf.ServerSessionPoolFactory */ protected String serverSessionPoolFactoryJNDI; /** -* Description of the Field +* JMS acknowledge mode, used when session is not XA. */ protected int acknowledgeMode; /** -* Description of the Field +* escription of the Field */ protected boolean isContainerManagedTx; /** @@ -115,15 +125,15 @@ */ protected boolean isNotSupportedTx; /** -* Description of the Field +* The container. */ protected Container container; /** -* Description of the Field +* The JMS connection. */ protected Connection connection; /** -* Description of the Field +* TH JMS connection consumer. */ protected ConnectionConsumer connectionConsumer; /** @@ -143,13 +153,13 @@ */ protected String beanName; /** -* Description of the Field +* Dead letter queue handler. */ protected DLQHandler dlqHandler; /** -* Description of the Field +* DLQConfig element from MDBConfig element from jboss.xml. */ - protected Element mdbConfig; + protected Element dlqConfig; /** * Instance logger. @@ -272,7 +282,9 @@ log.debug(Destroying JMSContainerInvoker for bean + beanName); // Take down DLQ - dlqHandler.destroy(); + if ( dlqHandler != null) { + dlqHandler.destroy(); + } // close the connection consumer try @@ -316,7 +328,10 @@ } /** -* XmlLoadable implementation +* XmlLoadable implementation. +* +* FIXME - we ought to move all config into MDBConfig, but I do not +* do that now due to backward compatibility. * * @param element Description of Parameter * @exception DeploymentException Description of Exception @@ -332,6 +347,22 @@ String maxSize = MetaData.getElementContent (MetaData.getUniqueChild(element, MaximumSize)); maxPoolSize = Integer.parseInt(maxSize); + + Element mdbConfig = MetaData.getUniqueChild(element, MDBConfig); + + String reconnect = MetaData.getElementContent + (MetaData.getUniqueChild(mdbConfig, ReconnectIntervalSec)); + reconnectInterval = Long.parseLong(reconnect)*1000; + + // Get Dead letter queue config - and save it for later use + Element dlqEl = MetaData.getOptionalChild(mdbConfig, DLQConfig); + if (dlqEl != null) { + dlqConfig = (Element)((Node)dlqEl).cloneNode(true); +
[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins/jms JMSContainerInvoker.java
User: starksm Date: 01/11/09 20:48:13 Modified:src/main/org/jboss/ejb/plugins/jms Tag: Branch_2_4 JMSContainerInvoker.java Log: Fix the javax.jms.* wildcard import Revision ChangesPath No revision No revision 1.12.4.5 +13 -5 jboss/src/main/org/jboss/ejb/plugins/jms/JMSContainerInvoker.java Index: JMSContainerInvoker.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/jms/JMSContainerInvoker.java,v retrieving revision 1.12.4.4 retrieving revision 1.12.4.5 diff -u -r1.12.4.4 -r1.12.4.5 --- JMSContainerInvoker.java 2001/11/02 08:42:34 1.12.4.4 +++ JMSContainerInvoker.java 2001/11/10 04:48:13 1.12.4.5 @@ -11,7 +11,18 @@ import java.lang.reflect.Method; import java.security.Principal; -import javax.jms.*; +import javax.jms.Connection; +import javax.jms.ConnectionConsumer; +import javax.jms.Destination; +import javax.jms.ExceptionListener; +import javax.jms.JMSException; +import javax.jms.Message; +import javax.jms.MessageListener; +import javax.jms.Queue; +import javax.jms.QueueConnection; +import javax.jms.ServerSessionPool; +import javax.jms.Topic; +import javax.jms.TopicConnection; import javax.ejb.EJBMetaData; import javax.ejb.EJBHome; @@ -42,14 +53,11 @@ import org.jboss.ejb.Interceptor; import org.jboss.ejb.ContainerInvoker; import org.jboss.deployment.DeploymentException; - import org.jboss.metadata.XmlLoadable; import org.jboss.metadata.MetaData; import org.jboss.metadata.MessageDrivenMetaData; - import org.jboss.jms.jndi.JMSProviderAdapter; import org.jboss.jms.asf.ServerSessionPoolFactory; - import org.jboss.jms.asf.StdServerSessionPool; /** @@ -60,7 +68,7 @@ * @author a href=mailto:[EMAIL PROTECTED];Sebastien Alborini/a * @author a href=mailto:[EMAIL PROTECTED];Marc Fleury/a * @author a href=mailto:[EMAIL PROTECTED];Jason Dillon/a - * @version $Revision: 1.12.4.4 $ + * @version $Revision: 1.12.4.5 $ */ public class JMSContainerInvoker implements ContainerInvoker, XmlLoadable ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins/jms JMSContainerInvoker.java
User: starksm Date: 01/11/02 00:42:34 Modified:src/main/org/jboss/ejb/plugins/jms Tag: Branch_2_4 JMSContainerInvoker.java Log: Remove org.jboss.ejb.DeploymentException in favor of org.jboss.deploymen.DeploymentException Revision ChangesPath No revision No revision 1.12.4.4 +2 -2 jboss/src/main/org/jboss/ejb/plugins/jms/JMSContainerInvoker.java Index: JMSContainerInvoker.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/jms/JMSContainerInvoker.java,v retrieving revision 1.12.4.3 retrieving revision 1.12.4.4 diff -u -r1.12.4.3 -r1.12.4.4 --- JMSContainerInvoker.java 2001/10/22 10:19:33 1.12.4.3 +++ JMSContainerInvoker.java 2001/11/02 08:42:34 1.12.4.4 @@ -41,7 +41,7 @@ import org.jboss.ejb.ContainerInvokerContainer; import org.jboss.ejb.Interceptor; import org.jboss.ejb.ContainerInvoker; -import org.jboss.ejb.DeploymentException; +import org.jboss.deployment.DeploymentException; import org.jboss.metadata.XmlLoadable; import org.jboss.metadata.MetaData; @@ -60,7 +60,7 @@ * @author a href=mailto:[EMAIL PROTECTED];Sebastien Alborini/a * @author a href=mailto:[EMAIL PROTECTED];Marc Fleury/a * @author a href=mailto:[EMAIL PROTECTED];Jason Dillon/a - * @version $Revision: 1.12.4.3 $ + * @version $Revision: 1.12.4.4 $ */ public class JMSContainerInvoker implements ContainerInvoker, XmlLoadable ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins/jms JMSContainerInvoker.java
User: pra Date: 01/10/22 03:19:33 Modified:src/main/org/jboss/ejb/plugins/jms Tag: Branch_2_4 JMSContainerInvoker.java Log: Corrected bug in failovercode, notStoped was wrongly inited to false. Revision ChangesPath No revision No revision 1.12.4.3 +2 -2 jboss/src/main/org/jboss/ejb/plugins/jms/JMSContainerInvoker.java Index: JMSContainerInvoker.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/jms/JMSContainerInvoker.java,v retrieving revision 1.12.4.2 retrieving revision 1.12.4.3 diff -u -r1.12.4.2 -r1.12.4.3 --- JMSContainerInvoker.java 2001/08/23 03:58:14 1.12.4.2 +++ JMSContainerInvoker.java 2001/10/22 10:19:33 1.12.4.3 @@ -60,7 +60,7 @@ * @author a href=mailto:[EMAIL PROTECTED];Sebastien Alborini/a * @author a href=mailto:[EMAIL PROTECTED];Marc Fleury/a * @author a href=mailto:[EMAIL PROTECTED];Jason Dillon/a - * @version $Revision: 1.12.4.2 $ + * @version $Revision: 1.12.4.3 $ */ public class JMSContainerInvoker implements ContainerInvoker, XmlLoadable @@ -662,7 +662,7 @@ { JMSContainerInvoker invoker; // = null; Thread currentThread; // = null; - boolean notStoped; // = true; + boolean notStoped = true; ExceptionListenerImpl(final JMSContainerInvoker invoker) { this.invoker = invoker; ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins/jms JMSContainerInvoker.java
User: pra Date: 01/10/22 03:32:50 Modified:src/main/org/jboss/ejb/plugins/jms JMSContainerInvoker.java Log: Corrected bug in failovercode, notStoped was wrongly inited to false. Revision ChangesPath 1.31 +2 -3 jboss/src/main/org/jboss/ejb/plugins/jms/JMSContainerInvoker.java Index: JMSContainerInvoker.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/jms/JMSContainerInvoker.java,v retrieving revision 1.30 retrieving revision 1.31 diff -u -r1.30 -r1.31 --- JMSContainerInvoker.java 2001/09/25 03:34:46 1.30 +++ JMSContainerInvoker.java 2001/10/22 10:32:50 1.31 @@ -61,7 +61,7 @@ * /a * @authora href=mailto:[EMAIL PROTECTED];Marc Fleury/a * @authora href=mailto:[EMAIL PROTECTED];Jason Dillon/a - * @version $Revision: 1.30 $ + * @version $Revision: 1.31 $ */ public class JMSContainerInvoker implements ContainerInvoker, XmlLoadable @@ -936,8 +936,7 @@ // = null; Thread currentThread; // = null; - boolean notStoped; - // = true; + boolean notStoped = true; ExceptionListenerImpl(final JMSContainerInvoker invoker) { ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins/jms JMSContainerInvoker.java
User: chirino Date: 01/09/24 20:34:46 Modified:src/main/org/jboss/ejb/plugins/jms JMSContainerInvoker.java Log: Updated the MDB stuff so it supports local tx for both BMT and for CMT-NotSupported Revision ChangesPath 1.30 +13 -6 jboss/src/main/org/jboss/ejb/plugins/jms/JMSContainerInvoker.java Index: JMSContainerInvoker.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/jms/JMSContainerInvoker.java,v retrieving revision 1.29 retrieving revision 1.30 diff -u -r1.29 -r1.30 --- JMSContainerInvoker.java 2001/09/20 05:08:43 1.29 +++ JMSContainerInvoker.java 2001/09/25 03:34:46 1.30 @@ -61,7 +61,7 @@ * /a * @authora href=mailto:[EMAIL PROTECTED];Marc Fleury/a * @authora href=mailto:[EMAIL PROTECTED];Jason Dillon/a - * @version $Revision: 1.29 $ + * @version $Revision: 1.30 $ */ public class JMSContainerInvoker implements ContainerInvoker, XmlLoadable @@ -117,6 +117,10 @@ /** * Description of the Field */ + protected boolean isNotSupportedTx; + /** +* Description of the Field +*/ protected Container container; /** * Description of the Field @@ -398,7 +402,11 @@ // Is container managed? isContainerManagedTx = config.isContainerManagedTx(); acknowledgeMode = config.getAcknowledgeMode(); - + isNotSupportedTx = + config.getMethodTransactionType(onMessage, + new Class[]{Message.class}, + false) == MetaData.TX_NOT_SUPPORTED; + // Get configuration data from jboss.xml String destinationJNDI = config.getDestinationJndiName(); String user = config.getUser(); @@ -453,9 +461,8 @@ // set up the server session pool pool = createSessionPool(tConnection, maxPoolSize, - true, - // tx - acknowledgeMode, + true, // tx + acknowledgeMode , new MessageListenerImpl(this)); // To be no-durable or durable @@ -750,7 +757,7 @@ // the create the pool pool = factory.getServerSessionPool - (connection, maxSession, isTransacted, ack, isContainerManagedTx, listener); + (connection, maxSession, isTransacted, ack, !isContainerManagedTx || isNotSupportedTx, listener); } finally { ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins/jms JMSContainerInvoker.java
User: pra Date: 01/08/23 11:17:18 Modified:src/main/org/jboss/ejb/plugins/jms JMSContainerInvoker.java Log: Fixed the message-driven-destination is optional bug; this spec compliance means that some guessing have to be done. If its missing jboss.xml will be used to deduce the message destination type, if jboss.xml or destinationJNDI in it is missing it will default to Topic, which means the dreaded auto creation of destinations will then be Topics Revision ChangesPath 1.27 +48 -2 jboss/src/main/org/jboss/ejb/plugins/jms/JMSContainerInvoker.java Index: JMSContainerInvoker.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/jms/JMSContainerInvoker.java,v retrieving revision 1.26 retrieving revision 1.27 diff -u -r1.26 -r1.27 --- JMSContainerInvoker.java 2001/08/16 08:24:29 1.26 +++ JMSContainerInvoker.java 2001/08/23 18:17:18 1.27 @@ -60,7 +60,7 @@ * @author a href=mailto:[EMAIL PROTECTED];Sebastien Alborini/a * @author a href=mailto:[EMAIL PROTECTED];Marc Fleury/a * @author a href=mailto:[EMAIL PROTECTED];Jason Dillon/a - * @version $Revision: 1.26 $ + * @version $Revision: 1.27 $ */ public class JMSContainerInvoker implements ContainerInvoker, XmlLoadable @@ -69,6 +69,13 @@ /** {@link MessageListener#onMessage} reference. */ protected static /* final */ Method ON_MESSAGE; + + /** +* 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. +*/ + protected static final String DEFAULT_DESTINATION_TYPE = javax.jms.Topic; /** * Initialize the ON_MESSAGE reference. @@ -287,6 +294,37 @@ } /** +* 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. +* +* @param ctx The naming context to lookup destinations from. +* @param destinationJNDI The name to use when looking up destinations. +* @return The destination type, either derived from destinationJDNI or DEFAULT_DESTINATION_TYPE +*/ + protected String getDestinationType(Context ctx, String destinationJNDI) { + String destType = null; + + if (destinationJNDI != null) { + try { + Destination dest = (Destination)ctx.lookup(destinationJNDI); + if (dest instanceof javax.jms.Topic) +destType = javax.jms.Topic; + else if (dest instanceof javax.jms.Queue) +destType = javax.jms.Queue; + }catch(NamingException ex) { + log.debug(Could not do heristic lookup of destination + ex, ex); + } + + } + if (destType == null) { + log.info(WARNING Could not determine destination type, defaults to: + DEFAULT_DESTINATION_TYPE); + destType = DEFAULT_DESTINATION_TYPE; + } + return destType; + } + + /** * Create a server session pool for the given connection. * * @param connection The connection to use. @@ -347,7 +385,7 @@ // Selector String messageSelector = config.getMessageSelector(); - // Queue or Topic + // Queue or Topic - optional unfortunately String destinationType = config.getDestinationType(); // Bean Name @@ -379,6 +417,14 @@ String jndiSuffix = parseJndiSuffix(destinationJNDI, config.getEjbName()); log.debug(jndiSuffix: + jndiSuffix); + + // Unfortunately the destination is optional, so if we do not have one + // here we have to look it up if we have a destinationJNDI, else give it + // a default. + if (destinationType == null) { + log.info(No message-driven-destination given, guessing type); + destinationType = getDestinationType(context, destinationJNDI); + } if (destinationType.equals(javax.jms.Topic)) { ___ Jboss-development mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins/jms JMSContainerInvoker.java
User: pkendall Date: 01/08/15 21:06:05 Modified:src/main/org/jboss/ejb/plugins/jms JMSContainerInvoker.java Log: Fix mdb undeploy bug. Revision ChangesPath 1.25 +643 -643 jboss/src/main/org/jboss/ejb/plugins/jms/JMSContainerInvoker.java Index: JMSContainerInvoker.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/jms/JMSContainerInvoker.java,v retrieving revision 1.24 retrieving revision 1.25 diff -u -r1.24 -r1.25 --- JMSContainerInvoker.java 2001/08/09 18:33:25 1.24 +++ JMSContainerInvoker.java 2001/08/16 04:06:05 1.25 @@ -54,657 +54,657 @@ /** * ContainerInvoker for JMS MessageDrivenBeans, based on JRMPContainerInvoker. - * + * * @author a href=mailto:[EMAIL PROTECTED];Peter Antman/a. * @author a href=mailto:[EMAIL PROTECTED];Rickard Öberg/a * @author a href=mailto:[EMAIL PROTECTED];Sebastien Alborini/a * @author a href=mailto:[EMAIL PROTECTED];Marc Fleury/a * @author a href=mailto:[EMAIL PROTECTED];Jason Dillon/a - * @version $Revision: 1.24 $ + * @version $Revision: 1.25 $ */ public class JMSContainerInvoker - implements ContainerInvoker, XmlLoadable + implements ContainerInvoker, XmlLoadable { - // Constants - + // Constants - - /** {@link MessageListener#onMessage} reference. */ - protected static /* final */ Method ON_MESSAGE; + /** {@link MessageListener#onMessage} reference. */ + protected static /* final */ Method ON_MESSAGE; - /** -* Initialize the ON_MESSAGE reference. -*/ - static { - try { - final Class type = MessageListener.class; - final Class arg = Message.class; - ON_MESSAGE = type.getMethod(onMessage, new Class[] { arg }); - } - catch (Exception e) { - e.printStackTrace(); - throw new ExceptionInInitializerError(e); - } - } - - /** Instance logger. */ - private final Category log = Category.getInstance(this.getClass()); - - // Attributes - - protected boolean optimize; // = false; - protected int maxMessagesNr = 1; - protected int maxPoolSize = 15; - protected String providerAdapterJNDI; - protected String serverSessionPoolFactoryJNDI; - protected int acknowledgeMode; - protected Container container; - protected Connection connection; - protected ConnectionConsumer connectionConsumer; - protected TransactionManager tm; - protected ServerSessionPool pool; - protected ExceptionListenerImpl exListener; - protected String beanName; - - // Static - - // Constructors -- - - // Public - - public void setOptimized(final boolean optimize) { - log.debug(Container Invoker optimize set to + optimize); - this.optimize = optimize; - } - - public boolean isOptimized() { - log.debug(Optimize in action: + optimize); - return optimize; - } - - public EJBMetaData getEJBMetaData() { - throw new Error(Not valid for MessageDriven beans); - } - - // ContainerInvoker implementation - - public EJBHome getEJBHome() { - throw new Error(Not valid for MessageDriven beans); - } - - public EJBObject getStatelessSessionEJBObject() { - throw new Error(Not valid for MessageDriven beans); - } - - public EJBObject getStatefulSessionEJBObject(Object id) { - throw new Error(Not valid for MessageDriven beans); - } - - public EJBObject getEntityEJBObject(Object id) { - throw new Error(Not valid for MessageDriven beans); - } - - public Collection getEntityCollection(Collection ids) { - throw new Error(Not valid for MessageDriven beans); - } - - public Object invoke(Object id, -Method m, -Object[] args, -Transaction tx, -Principal identity, -Object credential) - throws Exception - { - MethodInvocation mi = - new MethodInvocation(id, m, args, tx, identity, credential); - - // Set the right context classloader - ClassLoader oldCl = Thread.currentThread().getContextClassLoader(); - Thread.currentThread().setContextClassLoader(container.getClassLoader()); - - try { - return container.invoke(mi); - } - finally { -
[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins/jms JMSContainerInvoker.java
User: pra Date: 01/08/09 11:33:25 Modified:src/main/org/jboss/ejb/plugins/jms JMSContainerInvoker.java Log: Added better logging when new destinations are created instead of the exception stack wich was verry confusing; some better logging in the lifecycle methods (beans name) Revision ChangesPath 1.24 +11 -7 jboss/src/main/org/jboss/ejb/plugins/jms/JMSContainerInvoker.java Index: JMSContainerInvoker.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/jms/JMSContainerInvoker.java,v retrieving revision 1.23 retrieving revision 1.24 diff -u -r1.23 -r1.24 --- JMSContainerInvoker.java 2001/08/06 22:55:00 1.23 +++ JMSContainerInvoker.java 2001/08/09 18:33:25 1.24 @@ -60,7 +60,7 @@ * @author a href=mailto:[EMAIL PROTECTED];Sebastien Alborini/a * @author a href=mailto:[EMAIL PROTECTED];Marc Fleury/a * @author a href=mailto:[EMAIL PROTECTED];Jason Dillon/a - * @version $Revision: 1.23 $ + * @version $Revision: 1.24 $ */ public class JMSContainerInvoker implements ContainerInvoker, XmlLoadable @@ -102,6 +102,7 @@ protected TransactionManager tm; protected ServerSessionPool pool; protected ExceptionListenerImpl exListener; + protected String beanName; // Static @@ -252,8 +253,8 @@ } catch (NamingException e) { // if the lookup failes, the try to create it - log.warn(destination not found: + jndiName, e); - + log.warn(destination not found: + jndiName + reason: + e); + log.warn(creating a new temporary destination: + jndiName); // // attempt to create the destination (note, this is very // very, very unportable). @@ -348,6 +349,9 @@ // Queue or Topic String destinationType = config.getDestinationType(); + + // Bean Name + beanName = config.getEjbName(); // Is containermanages TX (not used?) boolean isContainerManagedTx = config.isContainerManagedTx(); @@ -471,7 +475,7 @@ */ public void start() throws Exception { - log.debug(Starting JMSContainerInvoker); + log.debug(Starting JMSContainerInvoker for bean + beanName); exListener = new ExceptionListenerImpl(this); connection.setExceptionListener(exListener); connection.start(); @@ -482,7 +486,7 @@ */ public void stop() { - log.debug(Stopping JMSContainerInvoker); + log.debug(Stopping JMSContainerInvoker for bean + beanName); // Silence the exception listener if (exListener != null) { exListener.stop(); @@ -520,7 +524,7 @@ */ public void destroy() { - log.debug(Destroying JMSContainerInvoker); + log.debug(Destroying JMSContainerInvoker for bean + beanName); // clear the server session pool (if it is clearable) try { @@ -632,7 +636,7 @@ id = message.getJMSMessageID(); } catch (JMSException e) { // what ? -id = JMSContainerInvoke; +id = JMSContainerInvoker; } // Invoke, shuld we catch any Exceptions?? ___ Jboss-development mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins/jms JMSContainerInvoker.java
User: user57 Date: 01/08/06 15:55:00 Modified:src/main/org/jboss/ejb/plugins/jms JMSContainerInvoker.java Log: o replaced ConnectionFactoryHelper.createConnection() with createTopicConnection() and createQueueConnection(), since a connection factory might implement all four interfaces we need to have another way to determine what to create. o JmsManagedConnection will only attempt to get topic or queue resources where appriprate (instead of trying to get topic stuff from a queue connection). Revision ChangesPath 1.23 +9 -29 jboss/src/main/org/jboss/ejb/plugins/jms/JMSContainerInvoker.java Index: JMSContainerInvoker.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/jms/JMSContainerInvoker.java,v retrieving revision 1.22 retrieving revision 1.23 diff -u -r1.22 -r1.23 --- JMSContainerInvoker.java 2001/08/03 17:15:49 1.22 +++ JMSContainerInvoker.java 2001/08/06 22:55:00 1.23 @@ -60,7 +60,7 @@ * @author a href=mailto:[EMAIL PROTECTED];Sebastien Alborini/a * @author a href=mailto:[EMAIL PROTECTED];Marc Fleury/a * @author a href=mailto:[EMAIL PROTECTED];Jason Dillon/a - * @version $Revision: 1.22 $ + * @version $Revision: 1.23 $ */ public class JMSContainerInvoker implements ContainerInvoker, XmlLoadable @@ -200,30 +200,6 @@ } /** -* Create a new connection from the given factory. -* -* @param factory An object that implements QueueConnectionFactory, -*XAQueueConnectionFactory, TopicConnectionFactory or -*XATopicConnectionFactory. -* @param usernameThe username to use or null for no user. -* @param passwordThe password for the given username or null if no -* @returnA new connection from the given factory. -* -* @throws JMSExceptionFailed to create connection. -*/ - protected Connection createConnection(final Object factory, - final String username, - final String password) - throws JMSException - { - connection = ConnectionFactoryHelper.createConnection - (factory, username, password); - log.debug(created connection: + connection); - - return connection; - } - - /** * Parse the JNDI suffix from the given JNDI name. * * @param jndinameThe JNDI name used to lookup the destination. @@ -407,8 +383,10 @@ // create a topic connection Object factory = context.lookup(adapter.getTopicFactoryRef()); TopicConnection tConnection = -(TopicConnection)createConnection(factory, user, password); - +(TopicConnection)ConnectionFactoryHelper.createTopicConnection +(factory, user, password); + connection = tConnection; + // lookup or create the destination topic Topic topic = (Topic)createDestination(Topic.class, @@ -457,8 +435,10 @@ // create a queue connection Object qFactory = context.lookup(adapter.getQueueFactoryRef()); QueueConnection qConnection = -(QueueConnection)createConnection(qFactory, user, password); - +(QueueConnection)ConnectionFactoryHelper.createQueueConnection +(qFactory, user, password); + connection = qConnection; + // lookup or create the destination queue Queue queue = (Queue)createDestination(Queue.class, ___ Jboss-development mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins/jms JMSContainerInvoker.java
User: user57 Date: 01/07/28 23:26:54 Modified:src/main/org/jboss/ejb/plugins/jms Tag: jboss_buildmagic JMSContainerInvoker.java Log: o updated jboss changes from main o almost have jboss/server module generating the correct binary structure o updated projecthelp to sort the target list. Revision ChangesPath No revision No revision 1.20.2.1 +4 -4 jboss/src/main/org/jboss/ejb/plugins/jms/JMSContainerInvoker.java Index: JMSContainerInvoker.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/jms/JMSContainerInvoker.java,v retrieving revision 1.20 retrieving revision 1.20.2.1 diff -u -r1.20 -r1.20.2.1 --- JMSContainerInvoker.java 2001/07/21 20:21:45 1.20 +++ JMSContainerInvoker.java 2001/07/29 06:26:54 1.20.2.1 @@ -60,7 +60,7 @@ * @author a href=mailto:[EMAIL PROTECTED];Sebastien Alborini/a * @author a href=mailto:[EMAIL PROTECTED];Marc Fleury/a * @author a href=mailto:[EMAIL PROTECTED];Jason Dillon/a - * @version $Revision: 1.20 $ + * @version $Revision: 1.20.2.1 $ */ public class JMSContainerInvoker implements ContainerInvoker, XmlLoadable @@ -287,10 +287,10 @@ String methodName; if (type == Topic.class) { -methodName = newTopic; +methodName = createTopic; } else if (type == Queue.class) { -methodName = newQueue; +methodName = createQueue; } else { // type was not a Topic or Queue, bad user @@ -299,7 +299,7 @@ } // invoke the server to create the destination - server.invoke(new ObjectName(JMS, service, JMSServer), + server.invoke(new ObjectName(JBossMQ, service, Server), methodName, new Object[] { jndiSuffix }, new String[] { java.lang.String }); ___ Jboss-development mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins/jms JMSContainerInvoker.java
User: chirino Date: 01/07/28 09:24:33 Modified:src/main/org/jboss/ejb/plugins/jms JMSContainerInvoker.java Log: Integrated the latest JBossMQ Revision ChangesPath 1.21 +4 -4 jboss/src/main/org/jboss/ejb/plugins/jms/JMSContainerInvoker.java Index: JMSContainerInvoker.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/jms/JMSContainerInvoker.java,v retrieving revision 1.20 retrieving revision 1.21 diff -u -r1.20 -r1.21 --- JMSContainerInvoker.java 2001/07/21 20:21:45 1.20 +++ JMSContainerInvoker.java 2001/07/28 16:24:33 1.21 @@ -60,7 +60,7 @@ * @author a href=mailto:[EMAIL PROTECTED];Sebastien Alborini/a * @author a href=mailto:[EMAIL PROTECTED];Marc Fleury/a * @author a href=mailto:[EMAIL PROTECTED];Jason Dillon/a - * @version $Revision: 1.20 $ + * @version $Revision: 1.21 $ */ public class JMSContainerInvoker implements ContainerInvoker, XmlLoadable @@ -287,10 +287,10 @@ String methodName; if (type == Topic.class) { -methodName = newTopic; +methodName = createTopic; } else if (type == Queue.class) { -methodName = newQueue; +methodName = createQueue; } else { // type was not a Topic or Queue, bad user @@ -299,7 +299,7 @@ } // invoke the server to create the destination - server.invoke(new ObjectName(JMS, service, JMSServer), + server.invoke(new ObjectName(JBossMQ, service, Server), methodName, new Object[] { jndiSuffix }, new String[] { java.lang.String }); ___ Jboss-development mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins/jms JMSContainerInvoker.java
User: user57 Date: 01/07/21 13:21:45 Modified:src/main/org/jboss/ejb/plugins/jms JMSContainerInvoker.java Log: o cleaned up some log messages o docuemted some more o added some commented asserts Revision ChangesPath 1.20 +40 -18 jboss/src/main/org/jboss/ejb/plugins/jms/JMSContainerInvoker.java Index: JMSContainerInvoker.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/jms/JMSContainerInvoker.java,v retrieving revision 1.19 retrieving revision 1.20 diff -u -r1.19 -r1.20 --- JMSContainerInvoker.java 2001/07/21 02:30:15 1.19 +++ JMSContainerInvoker.java 2001/07/21 20:21:45 1.20 @@ -60,7 +60,7 @@ * @author a href=mailto:[EMAIL PROTECTED];Sebastien Alborini/a * @author a href=mailto:[EMAIL PROTECTED];Marc Fleury/a * @author a href=mailto:[EMAIL PROTECTED];Jason Dillon/a - * @version $Revision: 1.19 $ + * @version $Revision: 1.20 $ */ public class JMSContainerInvoker implements ContainerInvoker, XmlLoadable @@ -285,23 +285,26 @@ MBeanServer server = (MBeanServer) MBeanServerFactory.findMBeanServer(null).iterator().next(); + String methodName; if (type == Topic.class) { -server.invoke(new ObjectName(JMS,service,JMSServer), - newTopic, new Object[]{ jndiSuffix }, - new String[] {java.lang.String}); +methodName = newTopic; } else if (type == Queue.class) { -server.invoke(new ObjectName(JMS,service,JMSServer), - newQueue, new Object[]{ jndiSuffix }, - new String[] {java.lang.String}); +methodName = newQueue; } else { // type was not a Topic or Queue, bad user throw new IllegalArgumentException - (expected javax.jms.Queue or javax.jms.Topic for type: + -type); + (expected javax.jms.Queue or javax.jms.Topic: + type); } - + + // invoke the server to create the destination + server.invoke(new ObjectName(JMS, service, JMSServer), + methodName, + new Object[] { jndiSuffix }, + new String[] { java.lang.String }); + + // try to look it up again return (Destination)ctx.lookup(jndiName); } } @@ -469,15 +472,18 @@ true, // tx acknowledgeMode, new MessageListenerImpl(this)); - + log.debug(server session pool: + pool); + + // create the connection consumer connectionConsumer = qConnection. createConnectionConsumer(queue, messageSelector, pool, maxMessagesNr); - - log.debug(Queue connectionConsumer set up); + log.debug(connection consumer: + connectionConsumer); } + + log.debug(initialized); } /** @@ -614,14 +620,29 @@ class MessageListenerImpl implements MessageListener { - JMSContainerInvoker invoker = null; - + /** The container invoker. */ + JMSContainerInvoker invoker; // = null; + + /** + * Construct a ttMessageListenerImpl/tt. + * + * @param invoker The container invoker. Must not be null. + */ MessageListenerImpl(final JMSContainerInvoker invoker) { + // assert invoker != null; + this.invoker = invoker; } - - public void onMessage(Message message) + + /** + * Process a message. + * + * @param messageThe message to process. + */ + public void onMessage(final Message message) { + // assert message != null; + if (log.isDebugEnabled()) { log.debug(processing message: + message); } @@ -629,7 +650,8 @@ Object id; try { id = message.getJMSMessageID(); - } catch(javax.jms.JMSException e) { + } catch (JMSException e) { +// what ? id = JMSContainerInvoke; } ___ Jboss-development mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins/jms JMSContainerInvoker.java
User: user57 Date: 01/07/20 19:08:02 Modified:src/main/org/jboss/ejb/plugins/jms JMSContainerInvoker.java Log: o Using ConnectionFactoryHelper to create connections o Factored out some of the common Queue Topic initalization so they can both use the same code. Note there is still some work that could be done here to clean things up. o Documented things a bit more. Revision ChangesPath 1.18 +253 -177 jboss/src/main/org/jboss/ejb/plugins/jms/JMSContainerInvoker.java Index: JMSContainerInvoker.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/jms/JMSContainerInvoker.java,v retrieving revision 1.17 retrieving revision 1.18 diff -u -r1.17 -r1.18 --- JMSContainerInvoker.java 2001/07/09 21:14:28 1.17 +++ JMSContainerInvoker.java 2001/07/21 02:08:01 1.18 @@ -35,6 +35,7 @@ import org.apache.log4j.Category; +import org.jboss.jms.ConnectionFactoryHelper; import org.jboss.ejb.MethodInvocation; import org.jboss.ejb.Container; import org.jboss.ejb.ContainerInvokerContainer; @@ -59,7 +60,7 @@ * @author a href=mailto:[EMAIL PROTECTED];Sebastien Alborini/a * @author a href=mailto:[EMAIL PROTECTED];Marc Fleury/a * @author a href=mailto:[EMAIL PROTECTED];Jason Dillon/a - * @version $Revision: 1.17 $ + * @version $Revision: 1.18 $ */ public class JMSContainerInvoker implements ContainerInvoker, XmlLoadable @@ -108,20 +109,17 @@ // Public - public void setOptimized(boolean optimize) - { + public void setOptimized(final boolean optimize) { log.debug(Container Invoker optimize set to + optimize); this.optimize = optimize; } - public boolean isOptimized() - { + public boolean isOptimized() { log.debug(Optimize in action: + optimize); return optimize; } - public EJBMetaData getEJBMetaData() - { + public EJBMetaData getEJBMetaData() { throw new Error(Not valid for MessageDriven beans); } @@ -171,7 +169,12 @@ } // ContainerService implementation --- - + + /** +* Set the container for which this is an invoker to. +* +* @param containerThe container for which this is an invoker to. +*/ public void setContainer(final Container container) { this.container = container; @@ -180,6 +183,8 @@ /** * Return the JMSProviderAdapter that should be used. +* +* @returnThe JMSProviderAdapter to use. */ protected JMSProviderAdapter getJMSProviderAdapter() throws NamingException @@ -195,23 +200,160 @@ } /** -* Return the ServerSessionPoolFactory that should be used. +* Create a new connection from the given factory. +* +* @param factory An object that implements QueueConnectionFactory, +*XAQueueConnectionFactory, TopicConnectionFactory or +*XATopicConnectionFactory. +* @param usernameThe username to use or null for no user. +* @param passwordThe password for the given username or null if no +* @returnA new connection from the given factory. +* +* @throws JMSExceptionFailed to create connection. */ - protected ServerSessionPoolFactory getServerSessionPoolFactory() - throws NamingException + protected Connection createConnection(final Object factory, + final String username, + final String password) + throws JMSException + { + log.debug(attempting to create connection from factory: + factory); + connection = ConnectionFactoryHelper.createConnection + (factory, username, password); + log.debug(created connection: + connection); + + return connection; + } + + /** +* Parse the JNDI suffix from the given JNDI name. +* +* @param jndinameThe JNDI name used to lookup the destination. +* @param defaultSuffix The default suffix to use if parsing fails. +* @returnThe parsed suffix or the defaultSuffix +*/ + protected String parseJndiSuffix(final String jndiname, +final String defautSuffix) + { + // jndiSuffix is merely the name that the user has given the MDB. + // since the jndi name contains the message type I have to split + // at the / if there is no slash then I use the entire jndi name... + String jndiSuffix = ; + if (jndiname != null) { + int indexOfSlash = jndiname.indexOf(/); + if (indexOfSlash != -1) {
[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins/jms JMSContainerInvoker.java
User: user57 Date: 01/07/09 14:14:28 Modified:src/main/org/jboss/ejb/plugins/jms JMSContainerInvoker.java Log: o using Log4j for logging Revision ChangesPath 1.17 +516 -447 jboss/src/main/org/jboss/ejb/plugins/jms/JMSContainerInvoker.java Index: JMSContainerInvoker.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/jms/JMSContainerInvoker.java,v retrieving revision 1.16 retrieving revision 1.17 diff -u -r1.16 -r1.17 --- JMSContainerInvoker.java 2001/07/02 11:35:44 1.16 +++ JMSContainerInvoker.java 2001/07/09 21:14:28 1.17 @@ -27,7 +27,14 @@ import javax.transaction.Transaction; import javax.transaction.TransactionManager; +import javax.management.MBeanServerFactory; +import javax.management.MBeanServer; +import javax.management.ObjectName; + +import org.w3c.dom.Element; +import org.apache.log4j.Category; + import org.jboss.ejb.MethodInvocation; import org.jboss.ejb.Container; import org.jboss.ejb.ContainerInvokerContainer; @@ -35,7 +42,6 @@ import org.jboss.ejb.ContainerInvoker; import org.jboss.ejb.DeploymentException; -import org.jboss.logging.Logger; import org.jboss.metadata.XmlLoadable; import org.jboss.metadata.MetaData; import org.jboss.metadata.MessageDrivenMetaData; @@ -43,518 +49,581 @@ import org.jboss.jms.jndi.JMSProviderAdapter; import org.jboss.jms.asf.ServerSessionPoolFactory; -import org.w3c.dom.Element; +import org.jboss.jms.asf.StdServerSessionPool; -import javax.management.MBeanServerFactory; -import javax.management.MBeanServer; -import javax.management.ObjectName; - /** * ContainerInvoker for JMS MessageDrivenBeans, based on JRMPContainerInvoker. - * description * - * @see related - * @author a href=mailto:[EMAIL PROTECTED];Peter Antman/a. - * @author a href=mailto:[EMAIL PROTECTED];Rickard Öberg/a - * @author a href=mailto:[EMAIL PROTECTED];Sebastien Alborini/a - * @author a href=mailto:[EMAIL PROTECTED];Marc Fleury/a - * @version $Revision: 1.16 $ + * @author a href=mailto:[EMAIL PROTECTED];Peter Antman/a. + * @author a href=mailto:[EMAIL PROTECTED];Rickard Öberg/a + * @author a href=mailto:[EMAIL PROTECTED];Sebastien Alborini/a + * @author a href=mailto:[EMAIL PROTECTED];Marc Fleury/a + * @author a href=mailto:[EMAIL PROTECTED];Jason Dillon/a + * @version $Revision: 1.17 $ */ -public class JMSContainerInvoker implements -ContainerInvoker, XmlLoadable +public class JMSContainerInvoker + implements ContainerInvoker, XmlLoadable { -// Constants - -static final String msgInterface = javax.jms.MessageListener; -static final String msgMethod = onMessage; -static final String msgArgument = javax.jms.Message; -static Method listenerMethod; -static { - // Get the method - try { - Class msgInterfaceClass = Class.forName(msgInterface); - Class argumentClass = Class.forName(msgArgument); - listenerMethod = msgInterfaceClass.getMethod(msgMethod, new Class[] {argumentClass}); - - } catch(ClassNotFoundException ex) { - Logger.error(Could not the classes for message interface + msgInterface + : + ex); - }catch(NoSuchMethodException ex) { - Logger.error(Could not get the method for message interface + msgMethod + : + ex); - } -}; + // Constants - - // Attributes -protected boolean optimize = false; -protected int maxMessagesNr = 1; -protected int maxPoolSize = 15; -protected String jMSProviderAdapterJNDI; -protected String serverSessionPoolFactoryJNDI; -protected int acknowledgeMode; - -protected Container container; - -protected Connection connection; -protected ConnectionConsumer connectionConsumer; -protected TransactionManager tm; -protected ServerSessionPool pool; -protected ExceptionListenerImpl exListener; + /** {@link MessageListener#onMessage} reference. */ + protected static /* final */ Method ON_MESSAGE; + /** +* Initialize the ON_MESSAGE reference. +*/ + static { + try { + final Class type = MessageListener.class; + final Class arg = Message.class; + ON_MESSAGE = type.getMethod(onMessage, new Class[] { arg }); + } + catch (Exception e) { + e.printStackTrace(); + throw new ExceptionInInitializerError(e); + } + } + /** Instance logger. */ + private final Category log = Category.getInstance(this.getClass()); + + // Attributes
[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins/jms JMSContainerInvoker.java
User: starksm Date: 01/07/08 14:19:29 Modified:src/main/org/jboss/ejb/plugins/jms Tag: Branch_2_4 JMSContainerInvoker.java Log: Merge the latest JBossMQ changes into the 2.4 release Revision ChangesPath No revision No revision 1.12.4.1 +560 -572 jboss/src/main/org/jboss/ejb/plugins/jms/JMSContainerInvoker.java Index: JMSContainerInvoker.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/jms/JMSContainerInvoker.java,v retrieving revision 1.12 retrieving revision 1.12.4.1 diff -u -r1.12 -r1.12.4.1 --- JMSContainerInvoker.java 2001/06/01 06:06:37 1.12 +++ JMSContainerInvoker.java 2001/07/08 21:19:29 1.12.4.1 @@ -1,572 +1,560 @@ -/* - * jBoss, the OpenSource EJB server - * - * Distributable under LGPL license. - * See terms of license at gnu.org. - */ -package org.jboss.ejb.plugins.jms; - -import java.util.Collection; -import java.util.Hashtable; -import java.lang.reflect.Method; -import java.security.Principal; - -import javax.jms.*; - -import javax.ejb.EJBMetaData; -import javax.ejb.EJBHome; -import javax.ejb.EJBObject; - -import javax.naming.Name; -import javax.naming.InitialContext; -import javax.naming.Context; -import javax.naming.NamingException; -import javax.naming.NameNotFoundException; - -import javax.transaction.Status; -import javax.transaction.Transaction; -import javax.transaction.TransactionManager; - - -import org.jboss.ejb.MethodInvocation; -import org.jboss.ejb.Container; -import org.jboss.ejb.ContainerInvokerContainer; -import org.jboss.ejb.Interceptor; -import org.jboss.ejb.ContainerInvoker; -import org.jboss.ejb.DeploymentException; - -import org.jboss.tm.TxManager; - -import org.jboss.logging.Logger; -import org.jboss.metadata.XmlLoadable; -import org.jboss.metadata.MetaData; -import org.jboss.metadata.MessageDrivenMetaData; - -import org.jboss.jms.jndi.JMSProviderAdapter; -import org.jboss.jms.asf.ServerSessionPoolFactory; - -import org.w3c.dom.Element; - -import javax.management.MBeanServerFactory; -import javax.management.MBeanServer; -import javax.management.ObjectName; - -/** - * ContainerInvoker for JMS MessageDrivenBeans, based on JRMPContainerInvoker. - * description - * - * @see related - * @author Peter Antman ([EMAIL PROTECTED]) - * @author Rickard Öberg ([EMAIL PROTECTED]) - * @author a href=mailto:[EMAIL PROTECTED];Sebastien Alborini/a - * @author a href=mailto:[EMAIL PROTECTED];Marc Fleury/a - * @version $Revision: 1.12 $ - */ -public class JMSContainerInvoker implements -ContainerInvoker, XmlLoadable -{ -// Constants - -static final String msgInterface = javax.jms.MessageListener; -static final String msgMethod = onMessage; -static final String msgArgument = javax.jms.Message; -static Method listenerMethod; -static { - // Get the method - try { - Class msgInterfaceClass = Class.forName(msgInterface); - Class argumentClass = Class.forName(msgArgument); - listenerMethod = msgInterfaceClass.getMethod(msgMethod, new Class[] {argumentClass}); - - } catch(ClassNotFoundException ex) { - Logger.error(Could not the classes for message interface + msgInterface + : + ex); - }catch(NoSuchMethodException ex) { - Logger.error(Could not get the method for message interface + msgMethod + : + ex); - } -}; - - // Attributes -protected boolean optimize = false; -protected int maxMessagesNr = 1; -protected int maxPoolSize = 15; -protected String jMSProviderAdapterJNDI; -protected String serverSessionPoolFactoryJNDI; -protected int acknowledgeMode; - -protected Container container; - -protected Connection connection; -protected ConnectionConsumer connectionConsumer; -protected TxManager tm; -protected ServerSessionPool pool; -protected ExceptionListenerImpl exListener; - - - // Static - - // Constructors -- - - // Public - public void setOptimized(boolean optimize) - { - this.optimize = optimize; - //DEBUGLogger.debug(Container Invoker optimize set to '+optimize+'); - } - - public boolean isOptimized() - { - //DEBUG Logger.debug(Optimize in action: '+optimize+'); - return optimize; - } - - public EJBMetaData getEJBMetaData()
[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins/jms JMSContainerInvoker.java
User: kimptoc Date: 01/07/02 04:35:44 Modified:src/main/org/jboss/ejb/plugins/jms JMSContainerInvoker.java Log: fixes to get a clean jikes compile - [ #433345 ] Jikes patch - thanx Jesper Revision ChangesPath 1.16 +22 -32 jboss/src/main/org/jboss/ejb/plugins/jms/JMSContainerInvoker.java Index: JMSContainerInvoker.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/jms/JMSContainerInvoker.java,v retrieving revision 1.15 retrieving revision 1.16 diff -u -r1.15 -r1.16 --- JMSContainerInvoker.java 2001/06/22 05:24:31 1.15 +++ JMSContainerInvoker.java 2001/07/02 11:35:44 1.16 @@ -58,7 +58,7 @@ * @author a href=mailto:[EMAIL PROTECTED];Rickard Öberg/a * @author a href=mailto:[EMAIL PROTECTED];Sebastien Alborini/a * @author a href=mailto:[EMAIL PROTECTED];Marc Fleury/a - * @version $Revision: 1.15 $ + * @version $Revision: 1.16 $ */ public class JMSContainerInvoker implements ContainerInvoker, XmlLoadable @@ -533,37 +533,27 @@ public void onException(JMSException ex) { currentThread = Thread.currentThread(); - try { - Logger.warning(MDB lost connection to provider); - boolean tryIt = true; - while(tryIt notStoped) { - Logger.log(MDB Trying to reconnect...); - try { - try { - Thread.sleep(1); - }catch(InterruptedException ie) { tryIt=false; return;} - //try { - // Reboot container - invoker.innerStop(); - invoker.destroy(); - invoker.init(); - invoker.start(); - tryIt = false; - Logger.log(OK - reconnected); - //return; - }catch(Exception e) { - Logger.log(MDB error reconnecting: +e); - } - } - - - //topicConnection.close(); - }catch(Exception je) { - Logger.warning(Could not restart connection + je); - je.printStackTrace(); - } finally { - currentThread = null; - } + + Logger.warning(MDB lost connection to provider); + boolean tryIt = true; + while(tryIt notStoped) { + Logger.log(MDB Trying to reconnect...); + try { + try { + Thread.sleep(1); + }catch(InterruptedException ie) { tryIt=false; return;} + // Reboot container + invoker.innerStop(); + invoker.destroy(); + invoker.init(); + invoker.start(); + tryIt = false; + Logger.log(OK - reconnected); + }catch(Exception e) { + Logger.log(MDB error reconnecting: +e); + } +} + currentThread = null; } } ___ Jboss-development mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins/jms JMSContainerInvoker.java
User: chirino Date: 01/06/21 22:24:31 Modified:src/main/org/jboss/ejb/plugins/jms JMSContainerInvoker.java Log: Updated JBoss with the latest JBossMQ which includes fixes for the recent threading issues. I have alos updated the JMProviderLoader so that the references to the connection factory locations can be set via JMX. The jboss.jcml file was updated so that MDBs uese the INVM IL for better performance. Revision ChangesPath 1.15 +3 -3 jboss/src/main/org/jboss/ejb/plugins/jms/JMSContainerInvoker.java Index: JMSContainerInvoker.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/jms/JMSContainerInvoker.java,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- JMSContainerInvoker.java 2001/06/21 00:25:54 1.14 +++ JMSContainerInvoker.java 2001/06/22 05:24:31 1.15 @@ -58,7 +58,7 @@ * @author a href=mailto:[EMAIL PROTECTED];Rickard Öberg/a * @author a href=mailto:[EMAIL PROTECTED];Sebastien Alborini/a * @author a href=mailto:[EMAIL PROTECTED];Marc Fleury/a - * @version $Revision: 1.14 $ + * @version $Revision: 1.15 $ */ public class JMSContainerInvoker implements ContainerInvoker, XmlLoadable @@ -233,7 +233,7 @@ // All classes are different between topics and queues!! TopicConnectionFactory topicFactory = (TopicConnectionFactory)context. -lookup(adapter.getTopicFactoryName()); +lookup(adapter.getTopicFactoryRef()); // Do we have a user - this is messy code (should be done for queues to) TopicConnection topicConnection; if(user != null) @@ -307,7 +307,7 @@ { Logger.debug(Got destination type Queue); QueueConnectionFactory queueFactory = - (QueueConnectionFactory)context.lookup(adapter.getQueueFactoryName()); + (QueueConnectionFactory)context.lookup(adapter.getQueueFactoryRef()); // Do we have a user QueueConnection queueConnection; ___ Jboss-development mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins/jms JMSContainerInvoker.java
User: mnf999 Date: 01/06/18 13:01:24 Modified:src/main/org/jboss/ejb/plugins/jms JMSContainerInvoker.java Log: Updating the new names and author tags to reflect the new coding guidelines Revision ChangesPath 1.13 +3 -3 jboss/src/main/org/jboss/ejb/plugins/jms/JMSContainerInvoker.java Index: JMSContainerInvoker.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/jms/JMSContainerInvoker.java,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- JMSContainerInvoker.java 2001/06/01 06:06:37 1.12 +++ JMSContainerInvoker.java 2001/06/18 20:01:24 1.13 @@ -56,11 +56,11 @@ * description * * @see related - * @author Peter Antman ([EMAIL PROTECTED]) - * @author Rickard Öberg ([EMAIL PROTECTED]) + * @author a href=mailto:[EMAIL PROTECTED];Peter Antman/a. + * @author a href=mailto:[EMAIL PROTECTED];Rickard Öberg/a * @author a href=mailto:[EMAIL PROTECTED];Sebastien Alborini/a * @author a href=mailto:[EMAIL PROTECTED];Marc Fleury/a - * @version $Revision: 1.12 $ + * @version $Revision: 1.13 $ */ public class JMSContainerInvoker implements ContainerInvoker, XmlLoadable ___ Jboss-development mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-development
Re: [JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins/jms JMSContainerInvoker.java
Hey, what is THIS? Have you discussed this feature with anybody! You certainly have not discussed it with me! Why have you made those changes? Is it for your personal needs? Is it because it is a generally good thing? My first impression is that this is NOT a good thing. Why, when it looks so tempting to be able to say to beginner: well just write a destination name, if it don't exist it will be created for you. But why it is also a BAD thing? Well, simply because you loose controll over what is actually happening. In client code: lookup(topic/MySpecialImportantTopic); In MDB deployment descriptor: topic/MySpecialImpotantTopic You see what will happen? Yes, the client will send its messages to one topic (no automatic creation here), and the MDB will listen on ANOTHER topic, namely a to the system unknown destination, since it was not correctly spelled. What do you other guys say on the list? Hiram? //Peter On 31 Maj, [EMAIL PROTECTED] wrote: User: thedug Date: 01/05/31 16:53:44 Modified:src/main/org/jboss/ejb/plugins/jms JMSContainerInvoker.java Log: Add auto generation for topic/queue if topic/queue doesn't already exist. Uses the mbean server to create a new topic/queue.. Revision ChangesPath 1.11 +54 -7 jboss/src/main/org/jboss/ejb/plugins/jms/JMSContainerInvoker.java Index: JMSContainerInvoker.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/jms/JMSContainerInvoker.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- JMSContainerInvoker.java2001/05/07 19:19:57 1.10 +++ JMSContainerInvoker.java2001/05/31 23:53:44 1.11 @@ -45,18 +45,24 @@ import org.jboss.jms.jndi.JMSProviderAdapter; import org.jboss.jms.asf.ServerSessionPoolFactory; +import org.exolab.jms.client.JmsServerSessionPool; + import org.w3c.dom.Element; +import javax.management.MBeanServerFactory; +import javax.management.MBeanServer; +import javax.management.ObjectName; + /** * ContainerInvoker for JMS MessageDrivenBeans, based on JRMPContainerInvoker. * description - * + * * @see related * @author Peter Antman ([EMAIL PROTECTED]) * @author Rickard Öberg ([EMAIL PROTECTED]) * @author a href=mailto:[EMAIL PROTECTED];Sebastien Alborini/a * @author a href=mailto:[EMAIL PROTECTED];Marc Fleury/a - * @version $Revision: 1.10 $ + * @version $Revision: 1.11 $ */ public class JMSContainerInvoker implements ContainerInvoker, XmlLoadable @@ -205,7 +211,24 @@ // Set up pool ServerSessionPoolFactory poolFactory = (ServerSessionPoolFactory)jbossContext.lookup(serverSessionPoolFactoryJNDI); - + + // jndiSuffix is merely the name that the user has given the MDB. + // since the jndi name contains the message type I have to split at the / + // if there is no slash then I use the entire jndi name. + String jndiSuffix = ; + if(destinationJNDI != null){ + int indexOfSlash = destinationJNDI.indexOf(/); + if(indexOfSlash != -1){ +jndiSuffix = destinationJNDI.substring(indexOfSlash+1); + }else{ +jndiSuffix = destinationJNDI; + } + + // if the jndi name from jboss.xml is null then lets use the ejbName + }else{ + jndiSuffix = config.getEjbName(); + } + MBeanServer server = (MBeanServer)MBeanServerFactory.findMBeanServer(null).iterator().next(); if (destinationType.equals(javax.jms.Topic)) { @@ -230,7 +253,18 @@ } // Lookup destination - Topic topic = (Topic)context.lookup(destinationJNDI); + // First Try a lookup. + // If that lookup fails then try to contact the MBeanServer and inoke a new... + // Then do lookup again.. + String topicJndi = topic/+jndiSuffix; + Topic topic; + try{ + topic = (Topic)context.lookup(topicJndi); + }catch(NamingException ne){ + Logger.log(JndiName not found:+topicJndi + ...attempting to recover); + server.invoke(new ObjectName(JMS,service,JMSServer), newTopic, new Object[]{jndiSuffix}, new String[] {java.lang.String}); + topic = (Topic)context.lookup(topicJndi); + } pool = poolFactory. getServerSessionPool( @@ -293,10 +327,23 @@ queueConnection = queueFactory.createQueueConnection(); } - // Lookup destination -
Re: [JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins/jms JMSContainerInvoker.java
Hi, I would have to agree with Peter on this one. I believe this goes against the spirit of the JMS spec, where JMS destinations are to be created EXPLICITLY using a vendor-defined administration interface. Having your app silently create destinations brings up nightmarish visions of BAD THINGS HAPPENING AND YOU DON'T KNOW WHY! I would vote +1 for this change to be rolled back. This does not mean that I am against an app being able to dynamically create a JMS destination, and I am working on a simple interface that can be used within an application to do just that, but I really don't think the MDB container is the place for that functionality. cheers, Joel Peter Antman wrote: Hey, what is THIS? Have you discussed this feature with anybody! You certainly have not discussed it with me! Why have you made those changes? Is it for your personal needs? Is it because it is a generally good thing? My first impression is that this is NOT a good thing. Why, when it looks so tempting to be able to say to beginner: well just write a destination name, if it don't exist it will be created for you. But why it is also a BAD thing? Well, simply because you loose controll over what is actually happening. In client code: lookup(topic/MySpecialImportantTopic); In MDB deployment descriptor: topic/MySpecialImpotantTopic You see what will happen? Yes, the client will send its messages to one topic (no automatic creation here), and the MDB will listen on ANOTHER topic, namely a to the system unknown destination, since it was not correctly spelled. What do you other guys say on the list? Hiram? //Peter ___ Jboss-development mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins/jms JMSContainerInvoker.java
User: thedug Date: 01/05/31 16:53:44 Modified:src/main/org/jboss/ejb/plugins/jms JMSContainerInvoker.java Log: Add auto generation for topic/queue if topic/queue doesn't already exist. Uses the mbean server to create a new topic/queue.. Revision ChangesPath 1.11 +54 -7 jboss/src/main/org/jboss/ejb/plugins/jms/JMSContainerInvoker.java Index: JMSContainerInvoker.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/jms/JMSContainerInvoker.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- JMSContainerInvoker.java 2001/05/07 19:19:57 1.10 +++ JMSContainerInvoker.java 2001/05/31 23:53:44 1.11 @@ -45,18 +45,24 @@ import org.jboss.jms.jndi.JMSProviderAdapter; import org.jboss.jms.asf.ServerSessionPoolFactory; +import org.exolab.jms.client.JmsServerSessionPool; + import org.w3c.dom.Element; +import javax.management.MBeanServerFactory; +import javax.management.MBeanServer; +import javax.management.ObjectName; + /** * ContainerInvoker for JMS MessageDrivenBeans, based on JRMPContainerInvoker. * description - * + * * @see related * @author Peter Antman ([EMAIL PROTECTED]) * @author Rickard Öberg ([EMAIL PROTECTED]) * @author a href=mailto:[EMAIL PROTECTED];Sebastien Alborini/a * @author a href=mailto:[EMAIL PROTECTED];Marc Fleury/a - * @version $Revision: 1.10 $ + * @version $Revision: 1.11 $ */ public class JMSContainerInvoker implements ContainerInvoker, XmlLoadable @@ -205,7 +211,24 @@ // Set up pool ServerSessionPoolFactory poolFactory = (ServerSessionPoolFactory)jbossContext.lookup(serverSessionPoolFactoryJNDI); - + + // jndiSuffix is merely the name that the user has given the MDB. + // since the jndi name contains the message type I have to split at the / + // if there is no slash then I use the entire jndi name. + String jndiSuffix = ; + if(destinationJNDI != null){ +int indexOfSlash = destinationJNDI.indexOf(/); +if(indexOfSlash != -1){ + jndiSuffix = destinationJNDI.substring(indexOfSlash+1); +}else{ + jndiSuffix = destinationJNDI; +} + +// if the jndi name from jboss.xml is null then lets use the ejbName +}else{ +jndiSuffix = config.getEjbName(); +} + MBeanServer server = (MBeanServer)MBeanServerFactory.findMBeanServer(null).iterator().next(); if (destinationType.equals(javax.jms.Topic)) { @@ -230,7 +253,18 @@ } // Lookup destination -Topic topic = (Topic)context.lookup(destinationJNDI); + // First Try a lookup. + // If that lookup fails then try to contact the MBeanServer and inoke a new... + // Then do lookup again.. +String topicJndi = topic/+jndiSuffix; +Topic topic; +try{ + topic = (Topic)context.lookup(topicJndi); +}catch(NamingException ne){ + Logger.log(JndiName not found:+topicJndi + ...attempting to recover); + server.invoke(new ObjectName(JMS,service,JMSServer), newTopic, new Object[]{jndiSuffix}, new String[] {java.lang.String}); + topic = (Topic)context.lookup(topicJndi); +} pool = poolFactory. getServerSessionPool( @@ -293,10 +327,23 @@ queueConnection = queueFactory.createQueueConnection(); } -// Lookup destination -Queue queue = (Queue)context.lookup(destinationJNDI); + // Lookup destination + // First Try a lookup. + // If that lookup fails then try to contact the MBeanServer and inoke a new... + // Then do lookup again.. + String queueJndi = queue/+jndiSuffix; + Queue queue; + try +{ + queue = (Queue)context.lookup(queueJndi); + } +catch(NamingException ne){ + Logger.log(JndiName not found:+queueJndi + ...attempting to recover); + server.invoke(new ObjectName(JMS:service=JMSServer), newQueue, new Object[]{jndiSuffix}, new String[] {java.lang.String}); + queue = (Queue)context.lookup(queueJndi); + } -pool = poolFactory. + pool = poolFactory. getServerSessionPool( queueConnection,
[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins/jms JMSContainerInvoker.java
User: thedug Date: 01/05/31 23:06:37 Modified:src/main/org/jboss/ejb/plugins/jms JMSContainerInvoker.java Log: Bad merge Had to remove an old import JmsServerSessionPool doesn't exist anymore Revision ChangesPath 1.12 +1 -3 jboss/src/main/org/jboss/ejb/plugins/jms/JMSContainerInvoker.java Index: JMSContainerInvoker.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/jms/JMSContainerInvoker.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- JMSContainerInvoker.java 2001/05/31 23:53:44 1.11 +++ JMSContainerInvoker.java 2001/06/01 06:06:37 1.12 @@ -45,8 +45,6 @@ import org.jboss.jms.jndi.JMSProviderAdapter; import org.jboss.jms.asf.ServerSessionPoolFactory; -import org.exolab.jms.client.JmsServerSessionPool; - import org.w3c.dom.Element; import javax.management.MBeanServerFactory; @@ -62,7 +60,7 @@ * @author Rickard Öberg ([EMAIL PROTECTED]) * @author a href=mailto:[EMAIL PROTECTED];Sebastien Alborini/a * @author a href=mailto:[EMAIL PROTECTED];Marc Fleury/a - * @version $Revision: 1.11 $ + * @version $Revision: 1.12 $ */ public class JMSContainerInvoker implements ContainerInvoker, XmlLoadable ___ Jboss-development mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins/jms JMSContainerInvoker.java
User: user57 Date: 01/04/17 14:27:14 Modified:src/main/org/jboss/ejb/plugins/jms JMSContainerInvoker.java Log: o Removing files OpenJMS specific files that have been migrated to the contrib/openjms CVS module. o Added AbstractJMSProviderAdapter, which provides most of the bits that are required to implement a JMS provider. o Modified JBossMQProvider (and OpenJMSProvider in contrib/openjms) to extend AbstractJMSProviderAdapter. Revision ChangesPath 1.9 +1 -4 jboss/src/main/org/jboss/ejb/plugins/jms/JMSContainerInvoker.java Index: JMSContainerInvoker.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/jms/JMSContainerInvoker.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- JMSContainerInvoker.java 2001/03/02 14:57:57 1.8 +++ JMSContainerInvoker.java 2001/04/17 21:27:14 1.9 @@ -45,11 +45,8 @@ import org.jboss.jms.jndi.JMSProviderAdapter; import org.jboss.jms.asf.ServerSessionPoolFactory; -import org.exolab.jms.client.JmsServerSessionPool; - import org.w3c.dom.Element; -//import org.exolab.jms.jndi.JndiConstants; /** * ContainerInvoker for JMS MessageDrivenBeans, based on JRMPContainerInvoker. * description @@ -59,7 +56,7 @@ * @author Rickard Öberg ([EMAIL PROTECTED]) * @author a href="mailto:[EMAIL PROTECTED]"Sebastien Alborini/a * @author a href="mailto:[EMAIL PROTECTED]"Marc Fleury/a - * @version $Revision: 1.8 $ + * @version $Revision: 1.9 $ */ public class JMSContainerInvoker implements ContainerInvoker, XmlLoadable ___ Jboss-development mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-development