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 Changes Path 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> * @author <a href="mailto:[EMAIL PROTECTED]">Marc Fleury</a> * @author <a 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