flume-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mpe...@apache.org
Subject git commit: FLUME-2208. Jetty's default SocketSelector leaks File descriptors
Date Wed, 09 Oct 2013 01:13:13 GMT
Updated Branches:
  refs/heads/trunk 20eed3fdc -> 02fc1a8cf


FLUME-2208. Jetty's default SocketSelector leaks File descriptors

(Hari Shreedharan via Mike Percy)


Project: http://git-wip-us.apache.org/repos/asf/flume/repo
Commit: http://git-wip-us.apache.org/repos/asf/flume/commit/02fc1a8c
Tree: http://git-wip-us.apache.org/repos/asf/flume/tree/02fc1a8c
Diff: http://git-wip-us.apache.org/repos/asf/flume/diff/02fc1a8c

Branch: refs/heads/trunk
Commit: 02fc1a8cf436dbc9327e96d21452b826978479f8
Parents: 20eed3f
Author: Mike Percy <mpercy@cloudera.com>
Authored: Tue Oct 8 18:12:10 2013 -0700
Committer: Mike Percy <mpercy@cloudera.com>
Committed: Tue Oct 8 18:12:10 2013 -0700

----------------------------------------------------------------------
 .../apache/flume/instrumentation/http/HTTPMetricsServer.java | 8 +++++++-
 .../main/java/org/apache/flume/source/http/HTTPSource.java   | 6 ++++--
 2 files changed, 11 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flume/blob/02fc1a8c/flume-ng-core/src/main/java/org/apache/flume/instrumentation/http/HTTPMetricsServer.java
----------------------------------------------------------------------
diff --git a/flume-ng-core/src/main/java/org/apache/flume/instrumentation/http/HTTPMetricsServer.java
b/flume-ng-core/src/main/java/org/apache/flume/instrumentation/http/HTTPMetricsServer.java
index 373e344..2c2c6f3 100644
--- a/flume-ng-core/src/main/java/org/apache/flume/instrumentation/http/HTTPMetricsServer.java
+++ b/flume-ng-core/src/main/java/org/apache/flume/instrumentation/http/HTTPMetricsServer.java
@@ -29,9 +29,11 @@ import javax.servlet.http.HttpServletResponse;
 import org.apache.flume.Context;
 import org.apache.flume.instrumentation.MonitorService;
 import org.apache.flume.instrumentation.util.JMXPollUtil;
+import org.mortbay.jetty.Connector;
 import org.mortbay.jetty.Request;
 import org.mortbay.jetty.Server;
 import org.mortbay.jetty.handler.AbstractHandler;
+import org.mortbay.jetty.nio.SelectChannelConnector;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -55,9 +57,13 @@ public class HTTPMetricsServer implements MonitorService {
 
   @Override
   public void start() {
-    jettyServer = new Server(port);
+    jettyServer = new Server();
     //We can use Contexts etc if we have many urls to handle. For one url,
     //specifying a handler directly is the most efficient.
+    SelectChannelConnector connector = new SelectChannelConnector();
+    connector.setReuseAddress(true);
+    connector.setPort(port);
+    jettyServer.setConnectors(new Connector[] {connector});
     jettyServer.setHandler(new HTTPMetricsHandler());
     try {
       jettyServer.start();

http://git-wip-us.apache.org/repos/asf/flume/blob/02fc1a8c/flume-ng-core/src/main/java/org/apache/flume/source/http/HTTPSource.java
----------------------------------------------------------------------
diff --git a/flume-ng-core/src/main/java/org/apache/flume/source/http/HTTPSource.java b/flume-ng-core/src/main/java/org/apache/flume/source/http/HTTPSource.java
index de79e8b..48c6492 100644
--- a/flume-ng-core/src/main/java/org/apache/flume/source/http/HTTPSource.java
+++ b/flume-ng-core/src/main/java/org/apache/flume/source/http/HTTPSource.java
@@ -28,7 +28,7 @@ import org.apache.flume.instrumentation.SourceCounter;
 import org.apache.flume.source.AbstractSource;
 import org.mortbay.jetty.Connector;
 import org.mortbay.jetty.Server;
-import org.mortbay.jetty.bio.SocketConnector;
+import org.mortbay.jetty.nio.SelectChannelConnector;
 import org.mortbay.jetty.security.SslSocketConnector;
 import org.mortbay.jetty.servlet.ServletHolder;
 import org.slf4j.Logger;
@@ -174,9 +174,11 @@ public class HTTPSource extends AbstractSource implements
       SslSocketConnector sslSocketConnector = new SslSocketConnector();
       sslSocketConnector.setKeystore(keyStorePath);
       sslSocketConnector.setKeyPassword(keyStorePassword);
+      sslSocketConnector.setReuseAddress(true);
       connectors[0] = sslSocketConnector;
     } else {
-      SocketConnector connector = new SocketConnector();
+      SelectChannelConnector connector = new SelectChannelConnector();
+      connector.setReuseAddress(true);
       connectors[0] = connector;
     }
 


Mime
View raw message