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

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Thu Jan 13 08:21:25 EST 2011


Author: kevin.conner at jboss.com
Date: 2011-01-13 08:21:25 -0500 (Thu, 13 Jan 2011)
New Revision: 36517

Added:
   labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/src/org/jboss/internal/soa/esb/rosetta/pooling/WrappedMessageConsumer.java
   labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/src/org/jboss/internal/soa/esb/rosetta/pooling/WrappedMessageProducer.java
   labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/src/org/jboss/internal/soa/esb/rosetta/pooling/WrappedQueueBrowser.java
   labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/src/org/jboss/internal/soa/esb/rosetta/pooling/WrappedSession.java
   labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/src/org/jboss/internal/soa/esb/rosetta/pooling/WrappedTopicSubscriber.java
   labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/src/org/jboss/internal/soa/esb/rosetta/pooling/WrappedXASession.java
Modified:
   labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/src/org/jboss/internal/soa/esb/rosetta/pooling/JmsSession.java
   labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/src/org/jboss/internal/soa/esb/rosetta/pooling/JmsXASession.java
Log:
Remove proxy/invocation handler usage: JBESB-3557

Modified: labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/src/org/jboss/internal/soa/esb/rosetta/pooling/JmsSession.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/src/org/jboss/internal/soa/esb/rosetta/pooling/JmsSession.java	2011-01-13 12:32:31 UTC (rev 36516)
+++ labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/src/org/jboss/internal/soa/esb/rosetta/pooling/JmsSession.java	2011-01-13 13:21:25 UTC (rev 36517)
@@ -22,10 +22,6 @@
 package org.jboss.internal.soa.esb.rosetta.pooling;
 
 import java.io.Serializable;
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
 import java.util.HashSet;
 
 import javax.jms.BytesMessage;
@@ -69,7 +65,7 @@
     /**
      * The session delegate.
      */
-    private final Session sessionDelegate ;
+    private final WrappedSession sessionDelegate ;
     /**
      * The pool instance id.
      */
@@ -117,15 +113,32 @@
     JmsSession(final JmsConnectionPool connectionPool, final JmsSessionPool sessionPool, final Session session, final long id, final int requestedAcknowledgeMode,
             final int acknowledgeMode)
     {
+        this(connectionPool, sessionPool, new WrappedSession(connectionPool, session), session, id, requestedAcknowledgeMode, acknowledgeMode) ;
+    }
+
+    /**
+     * Duplicate the session wrapper.
+     * @param connectionPool The connection pool associated with this session.
+     * @param sessionPool The session pool associated with this session.
+     * @param sessionDelegate The wrapped session delegate.
+     * @param session The session.
+     * @param id The pool instance id.
+     * @param requestedAcknowledgeMode The requested acknowledge mode for this session.
+     * @param acknowledgeMode The original acknowledge mode for this session.
+     */
+    JmsSession(final JmsConnectionPool connectionPool, final JmsSessionPool sessionPool, final WrappedSession sessionDelegate, final Session session,
+        final long id, final int requestedAcknowledgeMode, final int acknowledgeMode)
+    {
         this.connectionPool = connectionPool ;
         this.sessionPool = sessionPool ;
         this.id = id ;
         this.session = session ;
-        this.sessionDelegate = (Session)getExceptionHandler(connectionPool, Session.class, session) ;
+        this.sessionDelegate = sessionDelegate ;
+        sessionDelegate.setJmsSession(this) ;
         this.requestedAcknowledgeMode = requestedAcknowledgeMode ;
         this.acknowledgeMode = acknowledgeMode ;
     }
-    
+
     /**
      * Create the session wrapper.
      * @param connectionPool The connection pool associated with this session.
@@ -138,11 +151,29 @@
     JmsSession(final JmsConnectionPool connectionPool, final JmsSessionPool sessionPool, final Session session, final long id, final int requestedAcknowledgeMode)
         throws JMSException
     {
+        this(connectionPool, sessionPool, new WrappedSession(connectionPool, session), session, id, requestedAcknowledgeMode) ;
+    }
+
+    /**
+     * Create the session wrapper.
+     * @param connectionPool The connection pool associated with this session.
+     * @param sessionPool The session pool associated with this session.
+     * @param sessionDelegate The wrapped session delegate.
+     * @param session The session.
+     * @param id The pool instance id.
+     * @param requestedAcknowledgeMode The requested acknowledge mode for this session.
+     * @throws JMSException
+     */
+    JmsSession(final JmsConnectionPool connectionPool, final JmsSessionPool sessionPool, final WrappedSession sessionDelegate, final Session session,
+        final long id, final int requestedAcknowledgeMode)
+        throws JMSException
+    {
         this.connectionPool = connectionPool ;
         this.sessionPool = sessionPool ;
         this.id = id ;
         this.session = session ;
-        this.sessionDelegate = (Session)getExceptionHandler(connectionPool, Session.class, session) ;
+        this.sessionDelegate = sessionDelegate ;
+        sessionDelegate.setJmsSession(this) ;
         this.requestedAcknowledgeMode = requestedAcknowledgeMode ;
         acknowledgeMode = session.getAcknowledgeMode() ;
         // Workaround for JBESB-1873
@@ -342,9 +373,8 @@
         {
             queueBrowserSet = new HashSet<QueueBrowser>() ;
         }
-        final QueueBrowser result = getQueueBrowser(queueBrowser) ;
-        queueBrowserSet.add(result) ;
-        return (QueueBrowser)getExceptionHandler(connectionPool, QueueBrowser.class, result) ;
+        queueBrowserSet.add(queueBrowser) ;
+        return getQueueBrowser(queueBrowser) ;
     }
 
     private synchronized MessageConsumer trackMessageConsumer(MessageConsumer messageConsumer)
@@ -355,9 +385,8 @@
         {
             messageConsumerSet = new HashSet<MessageConsumer>() ;
         }
-        final MessageConsumer result = getMessageConsumer(messageConsumer) ;
-        messageConsumerSet.add(result) ;
-        return (MessageConsumer)getExceptionHandler(connectionPool, MessageConsumer.class, result) ;
+        messageConsumerSet.add(messageConsumer) ;
+        return getMessageConsumer(messageConsumer) ;
     }
 
     private synchronized TopicSubscriber trackTopicSubscriber(TopicSubscriber topicSubscriber)
@@ -368,9 +397,8 @@
         {
             messageConsumerSet = new HashSet<MessageConsumer>() ;
         }
-        final TopicSubscriber result = getTopicSubscriber(topicSubscriber) ;
-        messageConsumerSet.add(result) ;
-        return (TopicSubscriber)getExceptionHandler(connectionPool, TopicSubscriber.class, result) ;
+        messageConsumerSet.add(topicSubscriber) ;
+        return getTopicSubscriber(topicSubscriber) ;
     }
 
     private synchronized MessageProducer trackMessageProducer(MessageProducer messageProducer)
@@ -381,9 +409,8 @@
         {
             messageProducerSet = new HashSet<MessageProducer>() ;
         }
-        final MessageProducer result = getMessageProducer(messageProducer) ;
-        messageProducerSet.add(result) ;
-        return (MessageProducer)getExceptionHandler(connectionPool, MessageProducer.class, result) ;
+        messageProducerSet.add(messageProducer) ;
+        return getMessageProducer(messageProducer) ;
     }
 
     synchronized void releaseResources()
@@ -422,22 +449,22 @@
 
     protected QueueBrowser getQueueBrowser(QueueBrowser queueBrowser)
     {
-        return queueBrowser ;
+        return new WrappedQueueBrowser(connectionPool, this, queueBrowser) ;
     }
 
     protected MessageConsumer getMessageConsumer(MessageConsumer messageConsumer)
     {
-        return messageConsumer ;
+        return new WrappedMessageConsumer(connectionPool, this, messageConsumer) ;
     }
 
     protected TopicSubscriber getTopicSubscriber(TopicSubscriber topicSubscriber)
     {
-        return topicSubscriber ;
+        return new WrappedTopicSubscriber(connectionPool, this, topicSubscriber) ;
     }
 
     protected MessageProducer getMessageProducer(MessageProducer messageProducer)
     {
-        return messageProducer ;
+        return new WrappedMessageProducer(connectionPool, this, messageProducer) ;
     }
 
     protected void handleCloseSession(final JmsConnectionPool jmsConnectionPool)
@@ -489,67 +516,14 @@
         return invalid ;
     }
     
+    protected WrappedSession getSessionDelegate()
+    {
+        return sessionDelegate ;
+    }
+    
     public JmsSession duplicateSession()
     {
         invalid = true ;
         return new JmsSession(connectionPool, sessionPool, session, id, requestedAcknowledgeMode, acknowledgeMode) ;
     }
-
-    /**
-     * Wrap the object in an exception handler.
-     * @param connectionPool The connection pool associated with this session.
-     * @param instanceClass The interface type of the instance.
-     * @param instance The instance
-     * @return 
-     */
-    protected Object getExceptionHandler(final JmsConnectionPool connectionPool,
-            final Class<?> instanceClass, final Object instance)
-    {
-        final InvocationHandler handler = new ExceptionHandler(connectionPool, instance) ;
-        return Proxy.newProxyInstance(getClass().getClassLoader(), new Class[] {instanceClass}, handler);
-    }
-    
-    /**
-     * Handler responsible for intercepting JMS exceptions and checking for unreported closure.
-     * @author <a href='mailto:kevin.conner at jboss.com'>Kevin Conner</a>
-     */
-    private final class ExceptionHandler implements InvocationHandler
-    {
-        /**
-         * The connection pool.
-         */
-        private final JmsConnectionPool pool ;
-        /**
-         * The target instance.
-         */
-        private final Object target ;
-        
-        /**
-         * Construct the handler using the specified target.
-         * @param pool The associated connection pool.
-         * @param target The target instance.
-         */
-        public ExceptionHandler(final JmsConnectionPool pool, final Object target)
-        {
-            this.pool = pool ;
-            this.target = target ;
-        }
-        
-        public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
-        {
-            try
-            {
-                return method.invoke(target, args);
-            }
-            catch (final InvocationTargetException ite)
-            {
-                final Throwable th = ite.getCause() ;
-                if (th instanceof JMSException)
-                {
-                    pool.handleException(JmsSession.this, (JMSException)th) ;
-                }
-                throw th ;
-            }
-        }
-    }
 }

Modified: labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/src/org/jboss/internal/soa/esb/rosetta/pooling/JmsXASession.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/src/org/jboss/internal/soa/esb/rosetta/pooling/JmsXASession.java	2011-01-13 12:32:31 UTC (rev 36516)
+++ labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/src/org/jboss/internal/soa/esb/rosetta/pooling/JmsXASession.java	2011-01-13 13:21:25 UTC (rev 36517)
@@ -21,10 +21,6 @@
 */
 package org.jboss.internal.soa.esb.rosetta.pooling;
 
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
 import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.concurrent.atomic.AtomicInteger;
 
@@ -32,7 +28,6 @@
 import javax.jms.MessageConsumer;
 import javax.jms.MessageProducer;
 import javax.jms.QueueBrowser;
-import javax.jms.Session;
 import javax.jms.TopicSubscriber;
 import javax.jms.XASession;
 import javax.transaction.Synchronization;
@@ -67,9 +62,9 @@
      */
     private Cleanup cleanupAction = Cleanup.close ;
     /**
-     * Flag representing whether the handlers are valid or not.
+     * Flag representing whether the wrappers are valid or not.
      */
-    private AtomicBoolean handlerValid = new AtomicBoolean(true) ;
+    private AtomicBoolean wrapperValid = new AtomicBoolean(true) ;
     /**
      * Use count for tracking references.
      */
@@ -84,12 +79,12 @@
      * @param requestedAcknowledgeMode The requested acknowledge mode for this session.
      * @param acknowledgeMode The original acknowledge mode for this session.
      */
-    JmsXASession(final JmsConnectionPool connectionPool, final JmsSessionPool sessionPool, final Session session,
+    JmsXASession(final JmsConnectionPool connectionPool, final JmsSessionPool sessionPool, final XASession session,
         final long id, final int requestedAcknowledgeMode, final int acknowledgeMode)
     {
-        super(connectionPool, sessionPool, session, id, requestedAcknowledgeMode, acknowledgeMode) ;
+        super(connectionPool, sessionPool, new WrappedXASession(connectionPool, session), session, id, requestedAcknowledgeMode, acknowledgeMode) ;
         this.connectionPool = connectionPool ;
-        this.xaSessionDelegate = (XASession)getExceptionHandler(connectionPool, XASession.class, session) ;
+        this.xaSessionDelegate = (XASession)getSessionDelegate() ;
     }
     
     /**
@@ -104,9 +99,9 @@
     JmsXASession(final JmsConnectionPool connectionPool, final JmsSessionPool sessionPool, final XASession session, final long id, final int requestedAcknowledgeMode)
         throws JMSException
     {
-        super(connectionPool, sessionPool, session, id, requestedAcknowledgeMode) ;
+        super(connectionPool, sessionPool, new WrappedXASession(connectionPool, session), session, id, requestedAcknowledgeMode) ;
         this.connectionPool = connectionPool ;
-        this.xaSessionDelegate = (XASession)getExceptionHandler(connectionPool, XASession.class, session) ;
+        this.xaSessionDelegate = (XASession)getSessionDelegate() ;
     }
     
     @Override
@@ -133,29 +128,25 @@
     @Override
     protected MessageProducer getMessageProducer(MessageProducer messageProducer)
     {
-        final InvocationHandler handler = new AssociationHandler(messageProducer, handlerValid) ;
-        return (MessageProducer)Proxy.newProxyInstance(getClass().getClassLoader(), new Class[] {MessageProducer.class}, handler );
+        return new WrappedMessageProducer(connectionPool, this, messageProducer, wrapperValid) ;
     }
-    
+
     @Override
     protected MessageConsumer getMessageConsumer(MessageConsumer messageConsumer)
     {
-        final InvocationHandler handler = new AssociationHandler(messageConsumer, handlerValid) ;
-        return (MessageConsumer)Proxy.newProxyInstance(getClass().getClassLoader(), new Class[] {MessageConsumer.class}, handler);
+        return new WrappedMessageConsumer(connectionPool, this, messageConsumer, wrapperValid) ;
     }
     
     @Override
     protected QueueBrowser getQueueBrowser(QueueBrowser queueBrowser)
     {
-        final InvocationHandler handler = new AssociationHandler(queueBrowser, handlerValid) ;
-        return (QueueBrowser)Proxy.newProxyInstance(getClass().getClassLoader(), new Class[] {QueueBrowser.class}, handler);
+        return new WrappedQueueBrowser(connectionPool, this, queueBrowser, wrapperValid) ;
     }
     
     @Override
     protected TopicSubscriber getTopicSubscriber(TopicSubscriber topicSubscriber)
     {
-        final InvocationHandler handler = new AssociationHandler(topicSubscriber, handlerValid) ;
-        return (TopicSubscriber)Proxy.newProxyInstance(getClass().getClassLoader(), new Class[] {TopicSubscriber.class}, handler);
+        return new WrappedTopicSubscriber(connectionPool, this, topicSubscriber, wrapperValid) ;
     }
     
     private void releaseSession()
@@ -166,8 +157,8 @@
         }
         finally
         {
-            handlerValid.set(false) ;
-            handlerValid = new AtomicBoolean(true) ;
+            wrapperValid.set(false) ;
+            wrapperValid = new AtomicBoolean(true) ;
         }
     }
     
@@ -179,15 +170,15 @@
         }
         finally
         {
-            handlerValid.set(false) ;
-            handlerValid = new AtomicBoolean(true) ;
+            wrapperValid.set(false) ;
+            wrapperValid = new AtomicBoolean(true) ;
         }
     }
 
     public JmsSession duplicateSession()
     {
         invalid = true ;
-        return new JmsXASession(connectionPool, getSessionPool(), getSession(), getId(), getRequestedAcknowledgeMode(), acknowledgeMode) ;
+        return new JmsXASession(connectionPool, getSessionPool(), (XASession)getSession(), getId(), getRequestedAcknowledgeMode(), acknowledgeMode) ;
     }
     
     protected void incrementReferenceCount()
@@ -288,66 +279,4 @@
             }
         }
     }
-    
-    /**
-     * Handler responsible for associating XA resources.
-     * @author kevin
-     */
-    private final class AssociationHandler implements InvocationHandler
-    {
-        /**
-         * The target instance.
-         */
-        private final Object target ;
-        /**
-         * Flag representing validity of the handler.
-         */
-        private final AtomicBoolean handlerValid ;
-        
-        /**
-         * Construct the handler using the specified target.
-         * @param target The target instance.
-         * @param handlerValid The flag representing whether the handler is still valid.
-         */
-        public AssociationHandler(final Object target, final AtomicBoolean handlerValid)
-        {
-            this.target = target ;
-            this.handlerValid = handlerValid ;
-        }
-        
-        public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
-        {
-            final String methodName = method.getName() ;
-            if ("hashCode".equals(methodName))
-            {
-                return hashCode() ;
-            }
-            else if ("equals".equals(methodName))
-            {
-                return this.equals(args[0]) ;
-            }
-            else
-            {
-                if (handlerValid.get())
-                {
-                    if (!"close".equals(methodName))
-                    {
-                        associate() ;
-                    }
-                    try
-                    {
-                        return method.invoke(target, args);
-                    }
-                    catch (final InvocationTargetException ite)
-                    {
-                        throw ite.getCause() ;
-                    }
-                }
-                else
-                {
-                    throw new JMSException("Instance is no longer valid") ;
-                }
-            }
-        }
-    }
 }

Added: labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/src/org/jboss/internal/soa/esb/rosetta/pooling/WrappedMessageConsumer.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/src/org/jboss/internal/soa/esb/rosetta/pooling/WrappedMessageConsumer.java	                        (rev 0)
+++ labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/src/org/jboss/internal/soa/esb/rosetta/pooling/WrappedMessageConsumer.java	2011-01-13 13:21:25 UTC (rev 36517)
@@ -0,0 +1,198 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2011, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ */
+package org.jboss.internal.soa.esb.rosetta.pooling;
+
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageListener;
+
+/**
+ * Wrapped message consumer class.
+ */
+class WrappedMessageConsumer implements MessageConsumer
+{
+    /**
+     * The connection pool associated with the session.
+     */
+    protected final JmsConnectionPool connectionPool ;
+    /**
+     * The session associated with the consumer.
+     */
+    protected final JmsSession jmsSession ;
+    /**
+     * The message consumer.
+     */
+    private final MessageConsumer messageConsumer ;
+    /**
+     * valid flag for xa associations.
+     */
+    private final AtomicBoolean wrapperValid ;
+
+    /**
+     * Construct the wrapped message consumer.
+     * @param connectionPool The connection pool associated with the session.
+     * @param jmsSession The session associated with the consumer.
+     * @param messageConsumer The message consumer.
+     */
+    public WrappedMessageConsumer(final JmsConnectionPool connectionPool,
+        final JmsSession jmsSession, final MessageConsumer messageConsumer)
+    {
+        this(connectionPool, jmsSession, messageConsumer, null) ;
+    }
+
+    /**
+     * Construct the wrapped message consumer.
+     * @param connectionPool The connection pool associated with the session.
+     * @param jmsSession The session associated with the consumer.
+     * @param messageConsumer The message consumer.
+     * @param wrapperValid valid flag for xa associations.
+     */
+    public WrappedMessageConsumer(final JmsConnectionPool connectionPool,
+        final JmsSession jmsSession, final MessageConsumer messageConsumer,
+        final AtomicBoolean wrapperValid)
+    {
+        this.connectionPool = connectionPool ;
+        this.jmsSession = jmsSession ;
+        this.messageConsumer = messageConsumer ;
+        this.wrapperValid = wrapperValid ;
+    }
+
+    public void close()
+        throws JMSException
+    {
+        validate() ;
+        try
+        {
+            messageConsumer.close();
+        }
+        catch (final JMSException jmse)
+        {
+            connectionPool.handleException(jmsSession, jmse) ;
+            throw jmse ;
+        }
+    }
+
+    public MessageListener getMessageListener()
+        throws JMSException
+    {
+        associate() ;
+        try
+        {
+            return messageConsumer.getMessageListener() ;
+        }
+        catch (final JMSException jmse)
+        {
+            connectionPool.handleException(jmsSession, jmse) ;
+            throw jmse ;
+        }
+    }
+
+    public String getMessageSelector()
+        throws JMSException
+    {
+        associate() ;
+        try
+        {
+            return messageConsumer.getMessageSelector() ;
+        }
+        catch (final JMSException jmse)
+        {
+            connectionPool.handleException(jmsSession, jmse) ;
+            throw jmse ;
+        }
+    }
+
+    public Message receive()
+        throws JMSException
+    {
+        associate() ;
+        try
+        {
+            return messageConsumer.receive() ;
+        }
+        catch (final JMSException jmse)
+        {
+            connectionPool.handleException(jmsSession, jmse) ;
+            throw jmse ;
+        }
+    }
+
+    public Message receive(final long arg0)
+        throws JMSException
+    {
+        associate() ;
+        try
+        {
+            return messageConsumer.receive(arg0) ;
+        }
+        catch (final JMSException jmse)
+        {
+            connectionPool.handleException(jmsSession, jmse) ;
+            throw jmse ;
+        }
+    }
+
+    public Message receiveNoWait()
+        throws JMSException
+    {
+        associate() ;
+        try
+        {
+            return messageConsumer.receiveNoWait() ;
+        }
+        catch (final JMSException jmse)
+        {
+            connectionPool.handleException(jmsSession, jmse) ;
+            throw jmse ;
+        }
+    }
+
+    public void setMessageListener(final MessageListener listener)
+        throws JMSException
+    {
+        associate() ;
+        try
+        {
+            messageConsumer.setMessageListener(listener) ;
+        }
+        catch (final JMSException jmse)
+        {
+            connectionPool.handleException(jmsSession, jmse) ;
+            throw jmse ;
+        }
+    }
+
+    private void validate()
+        throws JMSException
+    {
+        if ((wrapperValid != null) && !wrapperValid.get())
+        {
+            throw new JMSException("Instance is no longer valid") ;
+        }
+    }
+
+    protected void associate()
+        throws JMSException
+    {
+        validate() ;
+        jmsSession.associate() ;
+    }
+}


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

Added: labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/src/org/jboss/internal/soa/esb/rosetta/pooling/WrappedMessageProducer.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/src/org/jboss/internal/soa/esb/rosetta/pooling/WrappedMessageProducer.java	                        (rev 0)
+++ labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/src/org/jboss/internal/soa/esb/rosetta/pooling/WrappedMessageProducer.java	2011-01-13 13:21:25 UTC (rev 36517)
@@ -0,0 +1,334 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2011, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ */
+package org.jboss.internal.soa.esb.rosetta.pooling;
+
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import javax.jms.Destination;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageProducer;
+
+/**
+ * Wrapped message producer class.
+ */
+class WrappedMessageProducer implements MessageProducer
+{
+    /**
+     * The connection pool associated with the session.
+     */
+    private final JmsConnectionPool connectionPool ;
+    /**
+     * The session associated with the producer.
+     */
+    private final JmsSession jmsSession ;
+    /**
+     * The message producer.
+     */
+    private final MessageProducer messageProducer ;
+    /**
+     * valid flag for xa associations.
+     */
+    private final AtomicBoolean wrapperValid ;
+
+    /**
+     * Construct the wrapped message producer.
+     * @param connectionPool The connection pool associated with the session.
+     * @param jmsSession The session associated with the producer.
+     * @param messageProducer The message producer.
+     */
+    public WrappedMessageProducer(final JmsConnectionPool connectionPool,
+        final JmsSession jmsSession, final MessageProducer messageProducer)
+    {
+        this(connectionPool, jmsSession, messageProducer, null) ;
+    }
+
+    /**
+     * Construct the wrapped message producer.
+     * @param connectionPool The connection pool associated with the session.
+     * @param jmsSession The session associated with the producer.
+     * @param messageProducer The message producer.
+     * @param wrapperValid valid flag for xa associations.
+     */
+    public WrappedMessageProducer(final JmsConnectionPool connectionPool,
+        final JmsSession jmsSession, final MessageProducer messageProducer,
+        final AtomicBoolean wrapperValid)
+    {
+        this.connectionPool = connectionPool ;
+        this.jmsSession = jmsSession ;
+        this.messageProducer = messageProducer ;
+        this.wrapperValid = wrapperValid ;
+    }
+
+    public void close()
+        throws JMSException
+    {
+        validate() ;
+        try
+        {
+            messageProducer.close() ;
+        }
+        catch (final JMSException jmse)
+        {
+            connectionPool.handleException(jmsSession, jmse) ;
+            throw jmse ;
+        }
+    }
+
+    public int getDeliveryMode()
+        throws JMSException
+    {
+        associate() ;
+        try
+        {
+            return messageProducer.getDeliveryMode() ;
+        }
+        catch (final JMSException jmse)
+        {
+            connectionPool.handleException(jmsSession, jmse) ;
+            throw jmse ;
+        }
+    }
+
+    public Destination getDestination()
+        throws JMSException
+    {
+        associate() ;
+        try
+        {
+            return messageProducer.getDestination() ;
+        }
+        catch (final JMSException jmse)
+        {
+            connectionPool.handleException(jmsSession, jmse) ;
+            throw jmse ;
+        }
+    }
+
+    public boolean getDisableMessageID()
+        throws JMSException
+    {
+        associate() ;
+        try
+        {
+            return messageProducer.getDisableMessageID() ;
+        }
+        catch (final JMSException jmse)
+        {
+            connectionPool.handleException(jmsSession, jmse) ;
+            throw jmse ;
+        }
+    }
+
+    public boolean getDisableMessageTimestamp()
+        throws JMSException
+    {
+        associate() ;
+        try
+        {
+            return messageProducer.getDisableMessageTimestamp() ;
+        }
+        catch (final JMSException jmse)
+        {
+            connectionPool.handleException(jmsSession, jmse) ;
+            throw jmse ;
+        }
+    }
+
+    public int getPriority()
+        throws JMSException
+    {
+        associate() ;
+        try
+        {
+            return messageProducer.getPriority() ;
+        }
+        catch (final JMSException jmse)
+        {
+            connectionPool.handleException(jmsSession, jmse) ;
+            throw jmse ;
+        }
+    }
+
+    public long getTimeToLive()
+        throws JMSException
+    {
+        associate() ;
+        try
+        {
+            return messageProducer.getTimeToLive() ;
+        }
+        catch (final JMSException jmse)
+        {
+            connectionPool.handleException(jmsSession, jmse) ;
+            throw jmse ;
+        }
+    }
+
+    public void send(Destination arg0, Message arg1, int arg2, int arg3,
+            long arg4)
+        throws JMSException
+    {
+        associate() ;
+        try
+        {
+            messageProducer.send(arg0, arg1, arg2, arg3, arg4) ;
+        }
+        catch (final JMSException jmse)
+        {
+            connectionPool.handleException(jmsSession, jmse) ;
+            throw jmse ;
+        }
+    }
+
+    public void send(Destination arg0, Message arg1)
+        throws JMSException
+    {
+        associate() ;
+        try
+        {
+            messageProducer.send(arg0, arg1) ;
+        }
+        catch (final JMSException jmse)
+        {
+            connectionPool.handleException(jmsSession, jmse) ;
+            throw jmse ;
+        }
+    }
+
+    public void send(Message arg0, int arg1, int arg2, long arg3)
+        throws JMSException
+    {
+        associate() ;
+        try
+        {
+            messageProducer.send(arg0, arg1, arg2, arg3) ;
+        }
+        catch (final JMSException jmse)
+        {
+            connectionPool.handleException(jmsSession, jmse) ;
+            throw jmse ;
+        }
+    }
+
+    public void send(Message arg0)
+        throws JMSException
+    {
+        associate() ;
+        try
+        {
+            messageProducer.send(arg0) ;
+        }
+        catch (final JMSException jmse)
+        {
+            connectionPool.handleException(jmsSession, jmse) ;
+            throw jmse ;
+        }
+    }
+
+    public void setDeliveryMode(int arg0)
+        throws JMSException
+    {
+        associate() ;
+        try
+        {
+            messageProducer.setDeliveryMode(arg0) ;
+        }
+        catch (final JMSException jmse)
+        {
+            connectionPool.handleException(jmsSession, jmse) ;
+            throw jmse ;
+        }
+    }
+
+    public void setDisableMessageID(boolean arg0)
+        throws JMSException
+    {
+        associate() ;
+        try
+        {
+            messageProducer.setDisableMessageID(arg0) ;
+        }
+        catch (final JMSException jmse)
+        {
+            connectionPool.handleException(jmsSession, jmse) ;
+            throw jmse ;
+        }
+    }
+
+    public void setDisableMessageTimestamp(boolean arg0)
+        throws JMSException
+    {
+        associate() ;
+        try
+        {
+            messageProducer.setDisableMessageTimestamp(arg0) ;
+        }
+        catch (final JMSException jmse)
+        {
+            connectionPool.handleException(jmsSession, jmse) ;
+            throw jmse ;
+        }
+    }
+
+    public void setPriority(int arg0)
+        throws JMSException
+    {
+        associate() ;
+        try
+        {
+            messageProducer.setPriority(arg0) ;
+        }
+        catch (final JMSException jmse)
+        {
+            connectionPool.handleException(jmsSession, jmse) ;
+            throw jmse ;
+        }
+    }
+
+    public void setTimeToLive(long arg0)
+        throws JMSException
+    {
+        associate() ;
+        try
+        {
+            messageProducer.setTimeToLive(arg0) ;
+        }
+        catch (final JMSException jmse)
+        {
+            connectionPool.handleException(jmsSession, jmse) ;
+            throw jmse ;
+        }
+    }
+
+    private void validate()
+        throws JMSException
+    {
+        if ((wrapperValid != null) && !wrapperValid.get())
+        {
+            throw new JMSException("Instance is no longer valid") ;
+        }
+    }
+
+    private void associate()
+        throws JMSException
+    {
+        validate() ;
+        jmsSession.associate() ;
+    }
+}


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

Added: labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/src/org/jboss/internal/soa/esb/rosetta/pooling/WrappedQueueBrowser.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/src/org/jboss/internal/soa/esb/rosetta/pooling/WrappedQueueBrowser.java	                        (rev 0)
+++ labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/src/org/jboss/internal/soa/esb/rosetta/pooling/WrappedQueueBrowser.java	2011-01-13 13:21:25 UTC (rev 36517)
@@ -0,0 +1,153 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2011, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ */
+package org.jboss.internal.soa.esb.rosetta.pooling;
+
+import java.util.Enumeration;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import javax.jms.JMSException;
+import javax.jms.Queue;
+import javax.jms.QueueBrowser;
+
+/**
+ * Wrapped queue browser class.
+ */
+class WrappedQueueBrowser implements QueueBrowser
+{
+    /**
+     * The connection pool associated with the session.
+     */
+    private final JmsConnectionPool connectionPool ;
+    /**
+     * The session associated with the browser.
+     */
+    private final JmsSession jmsSession ;
+    /**
+     * The queue browser.
+     */
+    private final QueueBrowser queueBrowser ;
+    /**
+     * valid flag for xa associations.
+     */
+    private final AtomicBoolean wrapperValid ;
+
+    /**
+     * Construct the wrapped queue browser.
+     * @param connectionPool The connection pool associated with the session.
+     * @param jmsSession The session associated with the browser.
+     * @param queueBrowser The queue browser.
+     */
+    public WrappedQueueBrowser(final JmsConnectionPool connectionPool,
+        final JmsSession jmsSession, final QueueBrowser queueBrowser)
+    {
+        this(connectionPool, jmsSession, queueBrowser, null) ;
+    }
+
+    /**
+     * Construct the wrapped queue browser.
+     * @param connectionPool The connection pool associated with the session.
+     * @param jmsSession The session associated with the browser.
+     * @param queueBrowser The queue browser.
+     * @param wrapperValid valid flag for xa associations.
+     */
+    public WrappedQueueBrowser(final JmsConnectionPool connectionPool,
+        final JmsSession jmsSession, final QueueBrowser queueBrowser,
+        final AtomicBoolean wrapperValid)
+    {
+        this.connectionPool = connectionPool ;
+        this.jmsSession = jmsSession ;
+        this.queueBrowser = queueBrowser ;
+        this.wrapperValid = wrapperValid ;
+    }
+
+    public void close()
+        throws JMSException
+    {
+        validate() ;
+        try
+        {
+            queueBrowser.close() ;
+        }
+        catch (final JMSException jmse)
+        {
+            connectionPool.handleException(jmsSession, jmse) ;
+            throw jmse ;
+        }
+    }
+
+    public Enumeration getEnumeration()
+        throws JMSException
+    {
+        associate() ;
+        try
+        {
+            return queueBrowser.getEnumeration() ;
+        }
+        catch (final JMSException jmse)
+        {
+            connectionPool.handleException(jmsSession, jmse) ;
+            throw jmse ;
+        }
+    }
+
+    public String getMessageSelector()
+        throws JMSException
+    {
+        associate() ;
+        try
+        {
+            return queueBrowser.getMessageSelector() ;
+        }
+        catch (final JMSException jmse)
+        {
+            connectionPool.handleException(jmsSession, jmse) ;
+            throw jmse ;
+        }
+    }
+
+    public Queue getQueue()
+        throws JMSException
+    {
+        associate() ;
+        try
+        {
+            return queueBrowser.getQueue() ;
+        }
+        catch (final JMSException jmse)
+        {
+            connectionPool.handleException(jmsSession, jmse) ;
+            throw jmse ;
+        }
+    }
+
+    private void validate()
+        throws JMSException
+    {
+        if ((wrapperValid != null) && !wrapperValid.get())
+        {
+            throw new JMSException("Instance is no longer valid") ;
+        }
+    }
+
+    private void associate()
+        throws JMSException
+    {
+        validate() ;
+        jmsSession.associate() ;
+    }
+}


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

Added: labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/src/org/jboss/internal/soa/esb/rosetta/pooling/WrappedSession.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/src/org/jboss/internal/soa/esb/rosetta/pooling/WrappedSession.java	                        (rev 0)
+++ labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/src/org/jboss/internal/soa/esb/rosetta/pooling/WrappedSession.java	2011-01-13 13:21:25 UTC (rev 36517)
@@ -0,0 +1,489 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2011, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ */
+package org.jboss.internal.soa.esb.rosetta.pooling;
+
+import java.io.Serializable;
+
+import javax.jms.BytesMessage;
+import javax.jms.Destination;
+import javax.jms.JMSException;
+import javax.jms.MapMessage;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageListener;
+import javax.jms.MessageProducer;
+import javax.jms.ObjectMessage;
+import javax.jms.Queue;
+import javax.jms.QueueBrowser;
+import javax.jms.Session;
+import javax.jms.StreamMessage;
+import javax.jms.TemporaryQueue;
+import javax.jms.TemporaryTopic;
+import javax.jms.TextMessage;
+import javax.jms.Topic;
+import javax.jms.TopicSubscriber;
+
+/**
+ * Wrapped topic subscriber class.
+ */
+class WrappedSession implements Session
+{
+    /**
+     * The connection pool associated with the session.
+     */
+    protected final JmsConnectionPool connectionPool ;
+    /**
+     * The session.
+     */
+    private final Session session ;
+    /**
+     * The session associated with the browser.
+     */
+    protected JmsSession jmsSession ;
+
+    /**
+     * Construct the wrapped topic subscriber.
+     * @param connectionPool The connection pool associated with the session.
+     * @param jmsSession The JmsSession associated with the subscriber.
+     * @param session The session.
+     */
+    public WrappedSession(final JmsConnectionPool connectionPool, final Session session)
+    {
+        this.connectionPool = connectionPool ;
+        this.session = session ;
+    }
+
+    protected void setJmsSession(final JmsSession jmsSession)
+    {
+        this.jmsSession = jmsSession ;
+    }
+
+    public void close()
+        throws JMSException
+    {
+        try
+        {
+            session.close() ;
+        }
+        catch (final JMSException jmse)
+        {
+            connectionPool.handleException(jmsSession, jmse) ;
+            throw jmse ;
+        }
+    }
+
+    public void commit()
+        throws JMSException
+    {
+        try
+        {
+            session.commit() ;
+        }
+        catch (final JMSException jmse)
+        {
+            connectionPool.handleException(jmsSession, jmse) ;
+            throw jmse ;
+        }
+    }
+
+    public QueueBrowser createBrowser(Queue arg0, String arg1)
+    
+        throws JMSException
+    {
+        try
+        {
+            return session.createBrowser(arg0, arg1) ;
+        }
+        catch (final JMSException jmse)
+        {
+            connectionPool.handleException(jmsSession, jmse) ;
+            throw jmse ;
+        }
+    }
+
+    public QueueBrowser createBrowser(Queue arg0)
+        throws JMSException
+    {
+        try
+        {
+            return session.createBrowser(arg0) ;
+        }
+        catch (final JMSException jmse)
+        {
+            connectionPool.handleException(jmsSession, jmse) ;
+            throw jmse ;
+        }
+    }
+
+    public BytesMessage createBytesMessage()
+        throws JMSException
+    {
+        try
+        {
+            return session.createBytesMessage() ;
+        }
+        catch (final JMSException jmse)
+        {
+            connectionPool.handleException(jmsSession, jmse) ;
+            throw jmse ;
+        }
+    }
+
+    public MessageConsumer createConsumer(Destination arg0, String arg1,
+            boolean arg2)
+        throws JMSException
+    {
+        try
+        {
+            return session.createConsumer(arg0, arg1, arg2) ;
+        }
+        catch (final JMSException jmse)
+        {
+            connectionPool.handleException(jmsSession, jmse) ;
+            throw jmse ;
+        }
+    }
+
+    public MessageConsumer createConsumer(Destination arg0, String arg1)
+        throws JMSException
+    {
+        try
+        {
+            return session.createConsumer(arg0, arg1) ;
+        }
+        catch (final JMSException jmse)
+        {
+            connectionPool.handleException(jmsSession, jmse) ;
+            throw jmse ;
+        }
+    }
+
+    public MessageConsumer createConsumer(Destination arg0)
+        throws JMSException
+    {
+        try
+        {
+            return session.createConsumer(arg0) ;
+        }
+        catch (final JMSException jmse)
+        {
+            connectionPool.handleException(jmsSession, jmse) ;
+            throw jmse ;
+        }
+    }
+
+    public TopicSubscriber createDurableSubscriber(Topic arg0, String arg1,
+            String arg2, boolean arg3)
+        throws JMSException
+    {
+        try
+        {
+            return session.createDurableSubscriber(arg0, arg1, arg2, arg3) ;
+        }
+        catch (final JMSException jmse)
+        {
+            connectionPool.handleException(jmsSession, jmse) ;
+            throw jmse ;
+        }
+    }
+
+    public TopicSubscriber createDurableSubscriber(Topic arg0, String arg1)
+        throws JMSException
+    {
+        try
+        {
+            return session.createDurableSubscriber(arg0, arg1) ;
+        }
+        catch (final JMSException jmse)
+        {
+            connectionPool.handleException(jmsSession, jmse) ;
+            throw jmse ;
+        }
+    }
+
+    public MapMessage createMapMessage()
+        throws JMSException
+    {
+        try
+        {
+            return session.createMapMessage() ;
+        }
+        catch (final JMSException jmse)
+        {
+            connectionPool.handleException(jmsSession, jmse) ;
+            throw jmse ;
+        }
+    }
+
+    public Message createMessage()
+        throws JMSException
+    {
+        try
+        {
+            return session.createMessage() ;
+        }
+        catch (final JMSException jmse)
+        {
+            connectionPool.handleException(jmsSession, jmse) ;
+            throw jmse ;
+        }
+    }
+
+    public ObjectMessage createObjectMessage()
+        throws JMSException
+    {
+        try
+        {
+            return session.createObjectMessage() ;
+        }
+        catch (final JMSException jmse)
+        {
+            connectionPool.handleException(jmsSession, jmse) ;
+            throw jmse ;
+        }
+    }
+
+    public ObjectMessage createObjectMessage(Serializable arg0)
+        throws JMSException
+    {
+        try
+        {
+            return session.createObjectMessage(arg0) ;
+        }
+        catch (final JMSException jmse)
+        {
+            connectionPool.handleException(jmsSession, jmse) ;
+            throw jmse ;
+        }
+    }
+
+    public MessageProducer createProducer(Destination arg0)
+        throws JMSException
+    {
+        try
+        {
+            return session.createProducer(arg0) ;
+        }
+        catch (final JMSException jmse)
+        {
+            connectionPool.handleException(jmsSession, jmse) ;
+            throw jmse ;
+        }
+    }
+
+    public Queue createQueue(String arg0)
+        throws JMSException
+    {
+        try
+        {
+            return session.createQueue(arg0) ;
+        }
+        catch (final JMSException jmse)
+        {
+            connectionPool.handleException(jmsSession, jmse) ;
+            throw jmse ;
+        }
+    }
+
+    public StreamMessage createStreamMessage()
+        throws JMSException
+    {
+        try
+        {
+            return session.createStreamMessage() ;
+        }
+        catch (final JMSException jmse)
+        {
+            connectionPool.handleException(jmsSession, jmse) ;
+            throw jmse ;
+        }
+    }
+
+    public TemporaryQueue createTemporaryQueue()
+        throws JMSException
+    {
+        try
+        {
+            return session.createTemporaryQueue() ;
+        }
+        catch (final JMSException jmse)
+        {
+            connectionPool.handleException(jmsSession, jmse) ;
+            throw jmse ;
+        }
+    }
+
+    public TemporaryTopic createTemporaryTopic()
+        throws JMSException
+    {
+        try
+        {
+            return session.createTemporaryTopic() ;
+        }
+        catch (final JMSException jmse)
+        {
+            connectionPool.handleException(jmsSession, jmse) ;
+            throw jmse ;
+        }
+    }
+
+    public TextMessage createTextMessage()
+        throws JMSException
+    {
+        try
+        {
+            return session.createTextMessage() ;
+        }
+        catch (final JMSException jmse)
+        {
+            connectionPool.handleException(jmsSession, jmse) ;
+            throw jmse ;
+        }
+    }
+
+    public TextMessage createTextMessage(String arg0)
+        throws JMSException
+    {
+        try
+        {
+            return session.createTextMessage(arg0) ;
+        }
+        catch (final JMSException jmse)
+        {
+            connectionPool.handleException(jmsSession, jmse) ;
+            throw jmse ;
+        }
+    }
+
+    public Topic createTopic(String arg0)
+        throws JMSException
+    {
+        try
+        {
+            return session.createTopic(arg0) ;
+        }
+        catch (final JMSException jmse)
+        {
+            connectionPool.handleException(jmsSession, jmse) ;
+            throw jmse ;
+        }
+    }
+
+    public int getAcknowledgeMode()
+        throws JMSException
+    {
+        try
+        {
+            return session.getAcknowledgeMode() ;
+        }
+        catch (final JMSException jmse)
+        {
+            connectionPool.handleException(jmsSession, jmse) ;
+            throw jmse ;
+        }
+    }
+
+    public MessageListener getMessageListener()
+        throws JMSException
+    {
+        try
+        {
+            return session.getMessageListener() ;
+        }
+        catch (final JMSException jmse)
+        {
+            connectionPool.handleException(jmsSession, jmse) ;
+            throw jmse ;
+        }
+    }
+
+    public boolean getTransacted()
+        throws JMSException
+    {
+        try
+        {
+            return session.getTransacted() ;
+        }
+        catch (final JMSException jmse)
+        {
+            connectionPool.handleException(jmsSession, jmse) ;
+            throw jmse ;
+        }
+    }
+
+    public void recover()
+        throws JMSException
+    {
+        try
+        {
+            session.recover() ;
+        }
+        catch (final JMSException jmse)
+        {
+            connectionPool.handleException(jmsSession, jmse) ;
+            throw jmse ;
+        }
+    }
+
+    public void rollback()
+        throws JMSException
+    {
+        try
+        {
+            session.rollback() ;
+        }
+        catch (final JMSException jmse)
+        {
+            connectionPool.handleException(jmsSession, jmse) ;
+            throw jmse ;
+        }
+    }
+
+    public void run()
+    {
+        session.run() ;
+    }
+
+    public void setMessageListener(MessageListener arg0)
+        throws JMSException
+    {
+        try
+        {
+            session.setMessageListener(arg0) ;
+        }
+        catch (final JMSException jmse)
+        {
+            connectionPool.handleException(jmsSession, jmse) ;
+            throw jmse ;
+        }
+    }
+
+    public void unsubscribe(String arg0)
+        throws JMSException
+    {
+        try
+        {
+            session.unsubscribe(arg0) ;
+        }
+        catch (final JMSException jmse)
+        {
+            connectionPool.handleException(jmsSession, jmse) ;
+            throw jmse ;
+        }
+    }
+}


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

Added: labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/src/org/jboss/internal/soa/esb/rosetta/pooling/WrappedTopicSubscriber.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/src/org/jboss/internal/soa/esb/rosetta/pooling/WrappedTopicSubscriber.java	                        (rev 0)
+++ labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/src/org/jboss/internal/soa/esb/rosetta/pooling/WrappedTopicSubscriber.java	2011-01-13 13:21:25 UTC (rev 36517)
@@ -0,0 +1,93 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2011, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ */
+package org.jboss.internal.soa.esb.rosetta.pooling;
+
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import javax.jms.JMSException;
+import javax.jms.Topic;
+import javax.jms.TopicSubscriber;
+
+/**
+ * Wrapped topic subscriber class.
+ */
+class WrappedTopicSubscriber extends WrappedMessageConsumer implements TopicSubscriber
+{
+    /**
+     * The topic subscriber.
+     */
+    private final TopicSubscriber topicSubscriber ;
+
+    /**
+     * Construct the wrapped topic subscriber.
+     * @param connectionPool The connection pool associated with the session.
+     * @param jmsSession The session associated with the subscriber.
+     * @param topicSubscriber The topic subscriber.
+     */
+    public WrappedTopicSubscriber(final JmsConnectionPool connectionPool,
+        final JmsSession jmsSession, final TopicSubscriber topicSubscriber)
+    {
+        super(connectionPool, jmsSession, topicSubscriber) ;
+        this.topicSubscriber = topicSubscriber ;
+    }
+
+    /**
+     * Construct the wrapped topic subscriber.
+     * @param connectionPool The connection pool associated with the session.
+     * @param jmsSession The session associated with the subscriber.
+     * @param topicSubscriber The topic subscriber.
+     * @param wrapperValid valid flag for xa associations.
+     */
+    public WrappedTopicSubscriber(final JmsConnectionPool connectionPool,
+        final JmsSession jmsSession, final TopicSubscriber topicSubscriber,
+        final AtomicBoolean wrapperValid)
+    {
+        super(connectionPool, jmsSession, topicSubscriber, wrapperValid) ;
+        this.topicSubscriber = topicSubscriber ;
+    }
+
+    public boolean getNoLocal()
+        throws JMSException
+    {
+        associate() ;
+        try
+        {
+            return topicSubscriber.getNoLocal() ;
+        }
+        catch (final JMSException jmse)
+        {
+            connectionPool.handleException(jmsSession, jmse) ;
+            throw jmse ;
+        }
+    }
+
+    public Topic getTopic()
+        throws JMSException
+    {
+        associate() ;
+        try
+        {
+            return topicSubscriber.getTopic() ;
+        }
+        catch (final JMSException jmse)
+        {
+            connectionPool.handleException(jmsSession, jmse) ;
+            throw jmse ;
+        }
+    }
+}


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

Added: labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/src/org/jboss/internal/soa/esb/rosetta/pooling/WrappedXASession.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/src/org/jboss/internal/soa/esb/rosetta/pooling/WrappedXASession.java	                        (rev 0)
+++ labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/src/org/jboss/internal/soa/esb/rosetta/pooling/WrappedXASession.java	2011-01-13 13:21:25 UTC (rev 36517)
@@ -0,0 +1,64 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2011, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ */
+package org.jboss.internal.soa.esb.rosetta.pooling;
+
+import javax.jms.JMSException;
+import javax.jms.Session;
+import javax.jms.XASession;
+import javax.transaction.xa.XAResource;
+
+/**
+ * Wrapped topic subscriber class.
+ */
+class WrappedXASession extends WrappedSession implements XASession
+{
+    /**
+     * The session.
+     */
+    private final XASession xaSession ;
+
+    /**
+     * Construct the wrapped topic subscriber.
+     * @param connectionPool The connection pool associated with the session.
+     * @param session The session.
+     */
+    public WrappedXASession(final JmsConnectionPool connectionPool, final XASession xaSession)
+    {
+        super(connectionPool, xaSession) ;
+        this.xaSession = xaSession ;
+    }
+
+    public Session getSession()
+        throws JMSException
+    {
+        try
+        {
+            return xaSession.getSession() ;
+        }
+        catch (final JMSException jmse)
+        {
+            connectionPool.handleException(jmsSession, jmse) ;
+            throw jmse ;
+        }
+    }
+    
+    public XAResource getXAResource()
+    {
+        return xaSession.getXAResource() ;
+    }
+}


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



More information about the jboss-svn-commits mailing list