[jboss-svn-commits] JBL Code SVN: r21224 - labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/rosetta/pooling.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Fri Jul 25 10:31:55 EDT 2008


Author: kevin.conner at jboss.com
Date: 2008-07-25 10:31:54 -0400 (Fri, 25 Jul 2008)
New Revision: 21224

Added:
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/rosetta/pooling/SessionExecutorInit.java
Modified:
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/rosetta/pooling/JmsSession.java
Log:
Force JBoss Messaging executor initialisation: JBESB-1873

Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/rosetta/pooling/JmsSession.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/rosetta/pooling/JmsSession.java	2008-07-25 13:51:04 UTC (rev 21223)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/rosetta/pooling/JmsSession.java	2008-07-25 14:31:54 UTC (rev 21224)
@@ -82,6 +82,11 @@
     {
         this.id = id ;
         this.session = session ;
+        // Workaround for JBESB-1873
+        if ("org.jboss.jms.client.JBossSession".equals(session.getClass().getName()))
+        {
+            SessionExecutorInit.initExecutor(session) ;
+        }
     }
 
     public long getId()

Added: labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/rosetta/pooling/SessionExecutorInit.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/rosetta/pooling/SessionExecutorInit.java	                        (rev 0)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/rosetta/pooling/SessionExecutorInit.java	2008-07-25 14:31:54 UTC (rev 21224)
@@ -0,0 +1,70 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.internal.soa.esb.rosetta.pooling;
+
+import javax.jms.Session;
+
+import org.jboss.jms.client.JBossSession;
+import org.jboss.jms.client.delegate.ClientSessionDelegate;
+import org.jboss.jms.client.state.HierarchicalState;
+import org.jboss.jms.client.state.SessionState;
+import org.jboss.jms.delegate.SessionDelegate;
+
+
+/**
+ * Force executor initialisation for JBossSession.
+ */
+public class SessionExecutorInit
+{
+    /**
+     * This method uses internal knowledge of the JBoss Messaging version
+     * used within the project.  It initialises the thread used in the internal
+     * QueuedExecutor so that it is created as a daemon thread instead of a normal
+     * application thread.
+     * 
+     * JBESB-1873
+     * 
+     * @param session The created session to check.
+     */
+    public static void initExecutor(final Session session)
+    {
+        try
+        {
+            if (session instanceof JBossSession)
+            {
+                final JBossSession jbossSession = (JBossSession)session ;
+                final SessionDelegate sessionDelegate = jbossSession.getDelegate() ;
+                if (sessionDelegate instanceof ClientSessionDelegate)
+                {
+                    final ClientSessionDelegate clientSessionDelegate = (ClientSessionDelegate)sessionDelegate ;
+                    final HierarchicalState state = clientSessionDelegate.getState() ;
+                    if (state instanceof SessionState)
+                    {
+                        final SessionState sessionState = (SessionState)state ;
+                        sessionState.getExecutor().restart() ;
+                    }
+                }
+            }
+        }
+        catch (final Throwable th) {} // Hide all errors 
+    }
+}


Property changes on: labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/rosetta/pooling/SessionExecutorInit.java
___________________________________________________________________
Name: svn:keywords
   + Rev Date
Name: svn:eol-style
   + native




More information about the jboss-svn-commits mailing list