changeset 886:0d876a03ab0b

add back Server.addConnector() - needed for ssl
author Franklin Schmidt <fschmidt@gmail.com>
date Tue, 04 Oct 2016 20:27:50 -0600
parents 150092cebf3e
children df84a1741687
files src/org/eclipse/jetty/server/Server.java
diffstat 1 files changed, 20 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
diff -r 150092cebf3e -r 0d876a03ab0b src/org/eclipse/jetty/server/Server.java
--- a/src/org/eclipse/jetty/server/Server.java	Tue Oct 04 20:11:48 2016 -0600
+++ b/src/org/eclipse/jetty/server/Server.java	Tue Oct 04 20:27:50 2016 -0600
@@ -22,6 +22,8 @@
 import java.net.InetSocketAddress;
 import java.util.Collections;
 import java.util.Enumeration;
+import java.util.List;
+import java.util.ArrayList;
 import java.util.concurrent.LinkedBlockingQueue;
 import java.util.concurrent.ThreadPoolExecutor;
 import java.util.concurrent.TimeUnit;
@@ -61,7 +63,7 @@
 
 	private final AttributesMap _attributes = new AttributesMap();
 	public final ThreadPoolExecutor threadPool;
-	public final Connector connector;
+	private final List<Connector> connectors = new ArrayList<Connector>();
 
 
 	/* ------------------------------------------------------------ */
@@ -72,13 +74,18 @@
 	{
 		setServer(this);
 
-		connector = new SelectChannelConnector();
+		Connector connector = new SelectChannelConnector();
 		connector.setPort(port);
 		connector.setServer(this);
+		connectors.add(connector);
 
 		threadPool = new ThreadPoolExecutor(256, 256, 60, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>());
 	}
 
+	// call before start
+	public void addConnector(Connector connector) {
+		connectors.add(connector);
+	}
 
 	/* ------------------------------------------------------------ */
 	@Override
@@ -97,12 +104,13 @@
 			mex.add(e);
 		}
 
-		if (mex.size()==0)
-		{
-			try{connector.start();}
-			catch(Throwable e)
-			{
-				mex.add(e);
+		if (mex.size()==0) {
+			for( Connector connector : connectors ) {
+				try{connector.start();}
+				catch(Throwable e)
+				{
+					mex.add(e);
+				}
 			}
 		}
 /*
@@ -137,7 +145,9 @@
 			Thread.sleep(_graceful);
 		}
 */
-		try{connector.stop();}catch(Throwable e){mex.add(e);}
+		for( Connector connector : connectors ) {
+			try{connector.stop();}catch(Throwable e){mex.add(e);}
+		}
 
 		threadPool.shutdownNow();
 
@@ -273,7 +283,7 @@
 	public void dump(Appendable out,String indent) throws IOException
 	{
 		dumpThis(out);
-		dump(out,indent,TypeUtil.asList(getHandlers()),getBeans(),Collections.singletonList(connector));
+		dump(out,indent,TypeUtil.asList(getHandlers()),getBeans(),connectors);
 	}