servicemix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ff...@apache.org
Subject svn commit: r933489 - /servicemix/smx4/features/trunk/camel/servicemix-camel/src/main/java/org/apache/servicemix/camel/nmr/ServiceMixProducer.java
Date Tue, 13 Apr 2010 06:26:56 GMT
Author: ffang
Date: Tue Apr 13 06:26:56 2010
New Revision: 933489

URL: http://svn.apache.org/viewvc?rev=933489&view=rev
Log:
[SMX4-516]The camel-nmr ServiceMixProducer creates a new Channel per-exchange, also doesn't
close it.

Modified:
    servicemix/smx4/features/trunk/camel/servicemix-camel/src/main/java/org/apache/servicemix/camel/nmr/ServiceMixProducer.java

Modified: servicemix/smx4/features/trunk/camel/servicemix-camel/src/main/java/org/apache/servicemix/camel/nmr/ServiceMixProducer.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/features/trunk/camel/servicemix-camel/src/main/java/org/apache/servicemix/camel/nmr/ServiceMixProducer.java?rev=933489&r1=933488&r2=933489&view=diff
==============================================================================
--- servicemix/smx4/features/trunk/camel/servicemix-camel/src/main/java/org/apache/servicemix/camel/nmr/ServiceMixProducer.java
(original)
+++ servicemix/smx4/features/trunk/camel/servicemix-camel/src/main/java/org/apache/servicemix/camel/nmr/ServiceMixProducer.java
Tue Apr 13 06:26:56 2010
@@ -30,6 +30,7 @@ import org.apache.servicemix.nmr.api.ser
 public class ServiceMixProducer extends DefaultProducer {
 	
     private static final String OPERATION_NAME = "operationName"; 
+    private Channel client;
 
     public ServiceMixProducer(ServiceMixEndpoint endpoint) {
         super(endpoint);
@@ -40,10 +41,9 @@ public class ServiceMixProducer extends 
     }
 
     public void process(Exchange exchange) throws Exception {
-    	
-    	NMR nmr = getEndpoint().getComponent().getNmr();
-    	Channel client = nmr.createChannel();
-    	
+
+        NMR nmr = getEndpoint().getComponent().getNmr();
+
         org.apache.servicemix.nmr.api.Exchange e 
         	= getEndpoint().getComponent().getBinding().populateNmrExchangeFromCamelExchange(exchange,
client);
             
@@ -79,5 +79,17 @@ public class ServiceMixProducer extends 
             	
     	}
 	}
+
+    @Override
+    protected void doStart() throws Exception {
+        NMR nmr = getEndpoint().getComponent().getNmr();
+        client = nmr.createChannel();
+    }
+
+    @Override
+    protected void doStop() throws Exception {
+        client.close();
+        client = null;
+    }
     
 }



Mime
View raw message