[seam-commits] Seam SVN: r14315 - branches/enterprise/JBPAPP_5_0/src/main/org/jboss/seam/jms.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Mon Feb 13 03:08:01 EST 2012


Author: manaRH
Date: 2012-02-13 03:08:00 -0500 (Mon, 13 Feb 2012)
New Revision: 14315

Modified:
   branches/enterprise/JBPAPP_5_0/src/main/org/jboss/seam/jms/QueueConnection.java
Log:
JBPAPP-8103 - logged and handled in try-catch block of calling QueueConnection.stop()

Modified: branches/enterprise/JBPAPP_5_0/src/main/org/jboss/seam/jms/QueueConnection.java
===================================================================
--- branches/enterprise/JBPAPP_5_0/src/main/org/jboss/seam/jms/QueueConnection.java	2012-02-10 19:07:23 UTC (rev 14314)
+++ branches/enterprise/JBPAPP_5_0/src/main/org/jboss/seam/jms/QueueConnection.java	2012-02-13 08:08:00 UTC (rev 14315)
@@ -11,10 +11,12 @@
 import org.jboss.seam.annotations.Create;
 import org.jboss.seam.annotations.Destroy;
 import org.jboss.seam.annotations.Install;
+import org.jboss.seam.annotations.Logger;
 import org.jboss.seam.annotations.Name;
 import org.jboss.seam.annotations.Scope;
 import org.jboss.seam.annotations.Unwrap;
 import org.jboss.seam.annotations.intercept.BypassInterceptors;
+import org.jboss.seam.log.Log;
 import org.jboss.seam.util.Naming;
 
 /**
@@ -29,9 +31,13 @@
 @Install(precedence=BUILT_IN, genericDependencies=ManagedQueueSender.class)
 public class QueueConnection
 {
+   
+   @Logger
+   private Log log;
+   
    private String queueConnectionFactoryJndiName = "UIL2ConnectionFactory";
    private javax.jms.QueueConnection queueConnection;
-
+   
    /**
     * The JNDI name of the QueueConnectionFactory
     */
@@ -39,7 +45,7 @@
    {
       return queueConnectionFactoryJndiName;
    }
-
+   
    public void setQueueConnectionFactoryJndiName(String jndiName)
    {
       this.queueConnectionFactoryJndiName = jndiName;
@@ -55,10 +61,19 @@
    @Destroy
    public void destroy() throws JMSException
    {
-      queueConnection.stop();
+      try
+      {
+         queueConnection.stop();
+      }
+      catch (javax.jms.IllegalStateException e)
+      {
+         // as for JEE v5 specs, section EE 6.6
+         log.warn("queueSession.stop() called during @Destroy in an invalid context for this container. Msg={0}", e.getMessage());
+      }
+      
       queueConnection.close();
    }
-
+   
    private QueueConnectionFactory getQueueConnectionFactory() throws NamingException
    {
       return (QueueConnectionFactory) Naming.getInitialContext().lookup(queueConnectionFactoryJndiName);
@@ -74,11 +89,11 @@
    {
       return (javax.jms.QueueConnection) Component.getInstance(QueueConnection.class);
    }
-
+   
    @Override
    public String toString()
    {
       return "QueueConnection(" + queueConnectionFactoryJndiName + ")";
    }
-
+   
 }



More information about the seam-commits mailing list