camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r821276 - in /camel/branches/camel-1.x: ./ components/camel-mina/src/main/java/org/apache/camel/component/mina/
Date Sat, 03 Oct 2009 08:52:46 GMT
Author: davsclaus
Date: Sat Oct  3 08:52:46 2009
New Revision: 821276

URL: http://svn.apache.org/viewvc?rev=821276&view=rev
Log:
Merged revisions 821272 via svnmerge from 
https://svn.apache.org/repos/asf/camel/trunk

........
  r821272 | davsclaus | 2009-10-03 10:45:31 +0200 (Sat, 03 Oct 2009) | 1 line
  
  CAMEL-2049: camel-mina now using thread model recommended by Mina documentation. Thanks
to Dmytro Rud for the patch.
........

Modified:
    camel/branches/camel-1.x/   (props changed)
    camel/branches/camel-1.x/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaComponent.java
    camel/branches/camel-1.x/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaConsumer.java
    camel/branches/camel-1.x/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaProducer.java

Propchange: camel/branches/camel-1.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Oct  3 08:52:46 2009
@@ -1 +1 @@
-/camel/trunk:736980,739733,739904,740251,740295,740306,740596,740663,741848,742231,742705,742739,742854,742856,742898,742906,743613,743762,743773,743920,743959-743960,744123,745105,745367,745541,745751,745826,745978,746269,746872,746895,746962,747258,747678-747704,748392,748436,748821,749563-749564,749574,749628-749629,749936,749956,750017,750334,750396,750761,750796,752068,752117,752418,752751-752755,752764-752773,752956,753087,753101,753175,755136,755487,756313,756348,756870,756939,757636,757693,757743,757865,758539,758563,758600,758617,758692,758990,759362,759453,759887,759931,760003,760890,760909,760937,761194,761536,761583,761607,762047,762633,762650,762935,763095,763484,763551,765154,765686,765729,765743,765824,766016,766289,766584,766588,766590,766602,766673,767403,767824,768342,769239,769346,769368,769434,770172,770906,771303,773193,773446,773781,774192,774383,774658-774659,776198,776289,776504,776975,778102,778689-778701,779121,779143,779489,781314-781349,781775,781
 923,781974,781993,782557,782594,782681,782886,782918-782923,783204,783248,783363,783639,783704,785564,785584,785599,787206,787581,787598,787605,787928,788393,789121,789703,790560,790936,791379,791476,791767,792038,792381,792398,792899,793359,793518,793547-793555,793862,793935,794237,794368,794550,794967,795790,798027,798052,798063,798489,798864,799252,800340,800785,800797,801084,801196,801960,802307,802478,803559,807476,810751,812937,814493,816105,817654,818063,818182-818354,818744,818747,819475,819483,819956,820152,820168
+/camel/trunk:736980,739733,739904,740251,740295,740306,740596,740663,741848,742231,742705,742739,742854,742856,742898,742906,743613,743762,743773,743920,743959-743960,744123,745105,745367,745541,745751,745826,745978,746269,746872,746895,746962,747258,747678-747704,748392,748436,748821,749563-749564,749574,749628-749629,749936,749956,750017,750334,750396,750761,750796,752068,752117,752418,752751-752755,752764-752773,752956,753087,753101,753175,755136,755487,756313,756348,756870,756939,757636,757693,757743,757865,758539,758563,758600,758617,758692,758990,759362,759453,759887,759931,760003,760890,760909,760937,761194,761536,761583,761607,762047,762633,762650,762935,763095,763484,763551,765154,765686,765729,765743,765824,766016,766289,766584,766588,766590,766602,766673,767403,767824,768342,769239,769346,769368,769434,770172,770906,771303,773193,773446,773781,774192,774383,774658-774659,776198,776289,776504,776975,778102,778689-778701,779121,779143,779489,781314-781349,781775,781
 923,781974,781993,782557,782594,782681,782886,782918-782923,783204,783248,783363,783639,783704,785564,785584,785599,787206,787581,787598,787605,787928,788393,789121,789703,790560,790936,791379,791476,791767,792038,792381,792398,792899,793359,793518,793547-793555,793862,793935,794237,794368,794550,794967,795790,798027,798052,798063,798489,798864,799252,800340,800785,800797,801084,801196,801960,802307,802478,803559,807476,810751,812937,814493,816105,817654,818063,818182-818354,818744,818747,819475,819483,819956,820152,820168,821272

Propchange: camel/branches/camel-1.x/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: camel/branches/camel-1.x/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaComponent.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-1.x/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaComponent.java?rev=821276&r1=821275&r2=821276&view=diff
==============================================================================
--- camel/branches/camel-1.x/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaComponent.java
(original)
+++ camel/branches/camel-1.x/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaComponent.java
Sat Oct  3 08:52:46 2009
@@ -21,6 +21,7 @@
 import java.net.URI;
 import java.nio.charset.Charset;
 import java.util.Map;
+import java.util.concurrent.Executors;
 
 import org.apache.camel.CamelContext;
 import org.apache.camel.Endpoint;
@@ -31,11 +32,13 @@
 import org.apache.mina.common.IoAcceptor;
 import org.apache.mina.common.IoConnector;
 import org.apache.mina.common.IoServiceConfig;
+import org.apache.mina.common.ThreadModel;
 import org.apache.mina.filter.LoggingFilter;
 import org.apache.mina.filter.codec.ProtocolCodecFactory;
 import org.apache.mina.filter.codec.ProtocolCodecFilter;
 import org.apache.mina.filter.codec.serialization.ObjectSerializationCodecFactory;
 import org.apache.mina.filter.codec.textline.LineDelimiter;
+import org.apache.mina.filter.executor.ExecutorFilter;
 import org.apache.mina.transport.socket.nio.DatagramAcceptor;
 import org.apache.mina.transport.socket.nio.DatagramAcceptorConfig;
 import org.apache.mina.transport.socket.nio.DatagramConnector;
@@ -153,14 +156,18 @@
         boolean minaLogger = configuration.isMinaLogger();
         long timeout = configuration.getTimeout();
         boolean sync = configuration.isSync();
+        final int processorCount = Runtime.getRuntime().availableProcessors() + 1;
 
-        IoAcceptor acceptor = new SocketAcceptor();
+        IoAcceptor acceptor = new SocketAcceptor(processorCount, Executors.newCachedThreadPool());
+        IoConnector connector = new SocketConnector(processorCount, Executors.newCachedThreadPool());
         SocketAddress address = new InetSocketAddress(configuration.getHost(), configuration.getPort());
-        IoConnector connector = new SocketConnector();
 
         // connector config
         SocketConnectorConfig connectorConfig = new SocketConnectorConfig();
+        // must use manual thread model according to Mina documentation
+        connectorConfig.setThreadModel(ThreadModel.MANUAL);
         configureCodecFactory("MinaProducer", connectorConfig, configuration);
+        connectorConfig.getFilterChain().addLast("threadPool", new ExecutorFilter(Executors.newCachedThreadPool()));
         if (minaLogger) {
             connectorConfig.getFilterChain().addLast("logger", new LoggingFilter());
         }
@@ -172,6 +179,7 @@
         configureCodecFactory("MinaConsumer", acceptorConfig, configuration);
         acceptorConfig.setReuseAddress(true);
         acceptorConfig.setDisconnectOnUnbind(true);
+        acceptorConfig.getFilterChain().addLast("threadPool", new ExecutorFilter(Executors.newCachedThreadPool()));
         if (minaLogger) {
             acceptorConfig.getFilterChain().addLast("logger", new LoggingFilter());
         }
@@ -224,9 +232,9 @@
         boolean transferExchange = configuration.isTransferExchange();
         boolean sync = configuration.isSync();
 
-        IoAcceptor acceptor = new DatagramAcceptor();
+        IoAcceptor acceptor = new DatagramAcceptor(Executors.newCachedThreadPool());
+        IoConnector connector = new DatagramConnector(Executors.newCachedThreadPool());
         SocketAddress address = new InetSocketAddress(configuration.getHost(), configuration.getPort());
-        IoConnector connector = new DatagramConnector();
 
         if (transferExchange) {
             throw new IllegalArgumentException("transferExchange=true is not supported for
datagram protocol");
@@ -234,6 +242,7 @@
 
         DatagramConnectorConfig connectorConfig = new DatagramConnectorConfig();
         configureDataGramCodecFactory("MinaProducer", connectorConfig, configuration);
+        connectorConfig.getFilterChain().addLast("threadPool", new ExecutorFilter(Executors.newCachedThreadPool()));
         if (minaLogger) {
             connectorConfig.getFilterChain().addLast("logger", new LoggingFilter());
         }

Modified: camel/branches/camel-1.x/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaConsumer.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-1.x/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaConsumer.java?rev=821276&r1=821275&r2=821276&view=diff
==============================================================================
--- camel/branches/camel-1.x/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaConsumer.java
(original)
+++ camel/branches/camel-1.x/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaConsumer.java
Sat Oct  3 08:52:46 2009
@@ -74,7 +74,7 @@
     }
 
     /**
-     * Handles comsuming messages and replying if the exchange is out capable.
+     * Handles consuming messages and replying if the exchange is out capable.
      */
     private final class ReceiveHandler extends IoHandlerAdapter {
 

Modified: camel/branches/camel-1.x/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaProducer.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-1.x/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaProducer.java?rev=821276&r1=821275&r2=821276&view=diff
==============================================================================
--- camel/branches/camel-1.x/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaProducer.java
(original)
+++ camel/branches/camel-1.x/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaProducer.java
Sat Oct  3 08:52:46 2009
@@ -36,7 +36,7 @@
 import org.apache.mina.transport.socket.nio.SocketConnector;
 
 /**
- * A {@link Producer} implementation for MINA
+ * A {@link org.apache.camel.Producer} implementation for MINA
  *
  * @version $Revision$
  */
@@ -110,7 +110,7 @@
             ResponseHandler handler = (ResponseHandler) session.getHandler();
             if (handler.getCause() != null) {
                 throw new CamelExchangeException("Response Handler had an exception", exchange,
handler.getCause());
-            } else if (!handler.isMessageRecieved()) {
+            } else if (!handler.isMessageReceived()) {
                 // no message received
                 throw new CamelExchangeException("No response received from remote server:
" + endpoint.getEndpointUri(), exchange);
             } else {
@@ -175,7 +175,7 @@
         private MinaEndpoint endpoint;
         private Object message;
         private Throwable cause;
-        private boolean messageRecieved;
+        private boolean messageReceived;
 
         private ResponseHandler(MinaEndpoint endpoint) {
             this.endpoint = endpoint;
@@ -184,7 +184,7 @@
         public void reset() {
             this.message = null;
             this.cause = null;
-            this.messageRecieved = false;
+            this.messageReceived = false;
         }
 
         @Override
@@ -193,7 +193,7 @@
                 LOG.debug("Message received: " + message);
             }
             this.message = message;
-            messageRecieved = true;
+            messageReceived = true;
             cause = null;
             countDown();
         }
@@ -223,7 +223,7 @@
             LOG.error("Exception on receiving message from address: " + this.endpoint.getAddress()
                     + " using connector: " + this.endpoint.getConnector(), cause);
             this.message = null;
-            this.messageRecieved = false;
+            this.messageReceived = false;
             this.cause = cause;
             if (ioSession != null) {
                 ioSession.close();
@@ -238,8 +238,8 @@
             return this.message;
         }
 
-        public boolean isMessageRecieved() {
-            return messageRecieved;
+        public boolean isMessageReceived() {
+            return messageReceived;
         }
     }
 



Mime
View raw message