FELIX-870 Added config property to allow NIO to be selectively disabled in favour of simple blocking sockets.
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@730709 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/http.jetty/src/main/java/org/apache/felix/http/jetty/Activator.java b/http.jetty/src/main/java/org/apache/felix/http/jetty/Activator.java
index a0d5bd9..e2eaef1 100644
--- a/http.jetty/src/main/java/org/apache/felix/http/jetty/Activator.java
+++ b/http.jetty/src/main/java/org/apache/felix/http/jetty/Activator.java
@@ -23,6 +23,7 @@
import org.mortbay.jetty.Connector;
import org.mortbay.jetty.Server;
import org.mortbay.jetty.handler.HandlerCollection;
+import org.mortbay.jetty.bio.SocketConnector;
import org.mortbay.jetty.nio.SelectChannelConnector;
import org.mortbay.jetty.security.HashUserRealm;
import org.mortbay.jetty.security.SslSocketConnector;
@@ -87,6 +88,10 @@
name of the service property to set with the https port used. If not supplied
then the HTTPS_PORT property name will be used for the service property */
public static final String HTTPS_SVCPROP_PORT = "org.apache.felix.http.svcprop.port.secure";
+
+ /** Felix specific property. Controls whether NIO will be used. If not supplied
+ then will default to true. */
+ public static final String HTTP_NIO = "org.apache.felix.http.nio";
/** Legacy Oscar property support. Controls whether to enable HTTPS */
public static final String OSCAR_HTTPS_ENABLE = "org.ungoverned.osgi.bundle.https.enable";
@@ -253,7 +258,8 @@
m_server.addUserRealm( realm );
// Add a regular HTTP listener
- Connector connector = new SelectChannelConnector();
+ Connector connector = getBooleanProperty( HTTP_NIO, true ) ?
+ (Connector) new SelectChannelConnector() : (Connector) new SocketConnector();
connector.addLifeCycleListener(
new ConnectorListener(getStringProperty(HTTP_SVCPROP_PORT, HTTP_PORT))
);