Author: ningjiang
Date: Sun Dec 4 14:49:52 2011
New Revision: 1210118
URL: http://svn.apache.org/viewvc?rev=1210118&view=rev
Log:
Merged revisions 1210113 via svnmerge from
https://svn.apache.org/repos/asf/camel/trunk
........
r1210113 | ningjiang | 2011-12-04 21:56:39 +0800 (Sun, 04 Dec 2011) | 1 line
CAMEL-4737 Added ReceiveBufferSizePredictor option on the camel-netty uri
........
Added:
camel/branches/camel-2.8.x/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyUDPLargeMessageInOnlyTest.java
- copied unchanged from r1210113,
camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyUDPLargeMessageInOnlyTest.java
Modified:
camel/branches/camel-2.8.x/ (props changed)
camel/branches/camel-2.8.x/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyConfiguration.java
camel/branches/camel-2.8.x/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyConsumer.java
camel/branches/camel-2.8.x/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyComponentWithConfigurationTest.java
Propchange: camel/branches/camel-2.8.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sun Dec 4 14:49:52 2011
@@ -1 +1 @@
-/camel/trunk:1202148,1202167,1202204-1202206,1202215,1202223,1202659,1202685,1203879,1203978,1204338,1205124,1205372,1205412,1205429,1205431,1205713,1206116,1206414,1207743,1207784,1208301,1208930,1208964-1208965,1209006-1209007,1209382,1209401,1209477,1209845-1209846
+/camel/trunk:1202148,1202167,1202204-1202206,1202215,1202223,1202659,1202685,1203879,1203978,1204338,1205124,1205372,1205412,1205429,1205431,1205713,1206116,1206414,1207743,1207784,1208301,1208930,1208964-1208965,1209006-1209007,1209382,1209401,1209477,1209845-1209846,1210113
Propchange: camel/branches/camel-2.8.x/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified:
camel/branches/camel-2.8.x/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyConfiguration.java
URL:
http://svn.apache.org/viewvc/camel/branches/camel-2.8.x/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyConfiguration.java?rev=1210118&r1=1210117&r2=1210118&view=diff
==============================================================================
---
camel/branches/camel-2.8.x/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyConfiguration.java
(original)
+++
camel/branches/camel-2.8.x/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyConfiguration.java
Sun Dec 4 14:49:52 2011
@@ -66,6 +66,7 @@ public class NettyConfiguration implemen
private boolean ssl;
private long sendBufferSize = 65536;
private long receiveBufferSize = 65536;
+ private int receiveBufferSizePredictor;
private int corePoolSize = 10;
private int maxPoolSize = 100;
private int workerCount;
@@ -349,6 +350,14 @@ public class NettyConfiguration implemen
public void setReceiveBufferSize(long receiveBufferSize) {
this.receiveBufferSize = receiveBufferSize;
}
+
+ public int getReceiveBufferSizePredictor() {
+ return receiveBufferSizePredictor;
+ }
+
+ public void setReceiveBufferSizePredictor(int receiveBufferSizePredictor) {
+ this.receiveBufferSizePredictor = receiveBufferSizePredictor;
+ }
public String getPassphrase() {
return passphrase;
Modified:
camel/branches/camel-2.8.x/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyConsumer.java
URL:
http://svn.apache.org/viewvc/camel/branches/camel-2.8.x/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyConsumer.java?rev=1210118&r1=1210117&r2=1210118&view=diff
==============================================================================
---
camel/branches/camel-2.8.x/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyConsumer.java
(original)
+++
camel/branches/camel-2.8.x/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyConsumer.java
Sun Dec 4 14:49:52 2011
@@ -26,6 +26,7 @@ import org.jboss.netty.bootstrap.Connect
import org.jboss.netty.bootstrap.ServerBootstrap;
import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelFactory;
+import org.jboss.netty.channel.FixedReceiveBufferSizePredictorFactory;
import org.jboss.netty.channel.group.ChannelGroup;
import org.jboss.netty.channel.group.ChannelGroupFuture;
import org.jboss.netty.channel.group.DefaultChannelGroup;
@@ -190,6 +191,11 @@ public class NettyConsumer extends Defau
connectionlessServerBootstrap.setOption("child.broadcast",
configuration.isBroadcast());
connectionlessServerBootstrap.setOption("sendBufferSize",
configuration.getSendBufferSize());
connectionlessServerBootstrap.setOption("receiveBufferSize",
configuration.getReceiveBufferSize());
+ // only set this if user has specified
+ if (configuration.getReceiveBufferSizePredictor() > 0) {
+
connectionlessServerBootstrap.setOption("receiveBufferSizePredictorFactory",
+ new
FixedReceiveBufferSizePredictorFactory(configuration.getReceiveBufferSizePredictor()));
+ }
channel = connectionlessServerBootstrap.bind(new
InetSocketAddress(configuration.getHost(), configuration.getPort()));
// to keep track of all channels in use
Modified:
camel/branches/camel-2.8.x/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyComponentWithConfigurationTest.java
URL:
http://svn.apache.org/viewvc/camel/branches/camel-2.8.x/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyComponentWithConfigurationTest.java?rev=1210118&r1=1210117&r2=1210118&view=diff
==============================================================================
---
camel/branches/camel-2.8.x/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyComponentWithConfigurationTest.java
(original)
+++
camel/branches/camel-2.8.x/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyComponentWithConfigurationTest.java
Sun Dec 4 14:49:52 2011
@@ -39,6 +39,10 @@ public class NettyComponentWithConfigura
// should not be same
assertNotSame(e1, e2);
assertNotSame(e1.getConfiguration(), e2.getConfiguration());
+
+ assertEquals(0, e2.getConfiguration().getReceiveBufferSizePredictor());
+ e2.getConfiguration().setReceiveBufferSizePredictor(1024);
+ assertEquals(1024,
e2.getConfiguration().getReceiveBufferSizePredictor());
e2.getConfiguration().setPort(5566);