[seam-commits] Seam SVN: r14314 - branches/enterprise/JBPAPP_5_1_0_JBPAPP-8090/src/main/org/jboss/seam/jms.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Fri Feb 10 14:07:24 EST 2012


Author: manaRH
Date: 2012-02-10 14:07:23 -0500 (Fri, 10 Feb 2012)
New Revision: 14314

Modified:
   branches/enterprise/JBPAPP_5_1_0_JBPAPP-8090/src/main/org/jboss/seam/jms/QueueConnection.java
Log:
JBPAPP-8090 backed port fix for JBSEAM-4666

Modified: branches/enterprise/JBPAPP_5_1_0_JBPAPP-8090/src/main/org/jboss/seam/jms/QueueConnection.java
===================================================================
--- branches/enterprise/JBPAPP_5_1_0_JBPAPP-8090/src/main/org/jboss/seam/jms/QueueConnection.java	2012-02-10 17:40:13 UTC (rev 14313)
+++ branches/enterprise/JBPAPP_5_1_0_JBPAPP-8090/src/main/org/jboss/seam/jms/QueueConnection.java	2012-02-10 19:07:23 UTC (rev 14314)
@@ -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,20 @@
    @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
+         // At least WebSphere v7 enforce this
+         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 +90,11 @@
    {
       return (javax.jms.QueueConnection) Component.getInstance(QueueConnection.class);
    }
-
+   
    @Override
    public String toString()
    {
       return "QueueConnection(" + queueConnectionFactoryJndiName + ")";
    }
-
+   
 }



More information about the seam-commits mailing list