You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by gn...@apache.org on 2006/08/23 14:29:41 UTC

svn commit: r434025 - /incubator/servicemix/trunk/servicemix-jms/src/main/java/org/apache/servicemix/jms/standard/StandardProviderProcessor.java

Author: gnodet
Date: Wed Aug 23 05:29:39 2006
New Revision: 434025

URL: http://svn.apache.org/viewvc?rev=434025&view=rev
Log:
Fix the standard provider

Modified:
    incubator/servicemix/trunk/servicemix-jms/src/main/java/org/apache/servicemix/jms/standard/StandardProviderProcessor.java

Modified: incubator/servicemix/trunk/servicemix-jms/src/main/java/org/apache/servicemix/jms/standard/StandardProviderProcessor.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-jms/src/main/java/org/apache/servicemix/jms/standard/StandardProviderProcessor.java?rev=434025&r1=434024&r2=434025&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-jms/src/main/java/org/apache/servicemix/jms/standard/StandardProviderProcessor.java (original)
+++ incubator/servicemix/trunk/servicemix-jms/src/main/java/org/apache/servicemix/jms/standard/StandardProviderProcessor.java Wed Aug 23 05:29:39 2006
@@ -43,11 +43,7 @@
 
 public class StandardProviderProcessor extends AbstractJmsProcessor {
 
-    protected Session session;
     protected Destination destination;
-    protected Destination replyToDestination;
-    protected MessageConsumer consumer;
-    protected MessageProducer producer;
     protected DeliveryChannel channel;
     
     public StandardProviderProcessor(JmsEndpoint endpoint) {
@@ -67,11 +63,7 @@
     }
 
     protected void doStop() throws Exception {
-        session = null;
         destination = null;
-        consumer = null;
-        producer = null;
-        replyToDestination = null;
     }
 
     public void process(MessageExchange exchange) throws Exception {
@@ -80,6 +72,7 @@
         } else if (exchange.getStatus() == ExchangeStatus.ERROR) {
             return;
         }
+        Session session = null;
         try {
             session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
             if (destination == null) {
@@ -89,7 +82,7 @@
                     destination = session.createTopic(endpoint.getJmsProviderDestinationName());
                 }
             }
-            producer = session.createProducer(destination);
+            MessageProducer producer = session.createProducer(destination);
             
             TextMessage msg = session.createTextMessage();
             NormalizedMessage nm = exchange.getMessage("in");
@@ -98,12 +91,13 @@
             if (exchange instanceof InOnly || exchange instanceof RobustInOnly) {
                 producer.send(msg);
             } else if (exchange instanceof InOut) {
+                Destination replyToDestination;
                 if (destination instanceof Queue) {
                     replyToDestination = session.createTemporaryQueue();
                 } else {
                     replyToDestination = session.createTemporaryTopic();
                 }
-                consumer = session.createConsumer(replyToDestination);
+                MessageConsumer consumer = session.createConsumer(replyToDestination);
                 msg.setJMSCorrelationID(exchange.getExchangeId());
                 msg.setJMSReplyTo(replyToDestination);
                 producer.send(msg);