diff src/org/eclipse/jetty/server/Server.java @ 864:e21ca9878a10

simplify ThreadPool use
author Franklin Schmidt <fschmidt@gmail.com>
date Sun, 02 Oct 2016 16:17:38 -0600
parents 22a4e93ed20e
children 6b210bb66c63
line wrap: on
line diff
--- a/src/org/eclipse/jetty/server/Server.java	Sun Oct 02 05:22:55 2016 -0600
+++ b/src/org/eclipse/jetty/server/Server.java	Sun Oct 02 16:17:38 2016 -0600
@@ -57,19 +57,10 @@
 {
 	private static final Logger LOG = LoggerFactory.getLogger(Server.class);
 
-	private static final String __version;
-	static
-	{
-		if (Server.class.getPackage()!=null &&
-			"Eclipse.org - Jetty".equals(Server.class.getPackage().getImplementationVendor()) &&
-			 Server.class.getPackage().getImplementationVersion()!=null)
-			__version=Server.class.getPackage().getImplementationVersion();
-		else
-			__version=System.getProperty("jetty.version","8.y.z-SNAPSHOT");
-	}
+	private static final String __version = "8";
 
 	private final AttributesMap _attributes = new AttributesMap();
-	private ThreadPool _threadPool;
+	private final ThreadPool _threadPool;
 	private Connector[] _connectors;
 	private boolean _sendServerVersion = true; //send Server: header
 	private boolean _sendDateHeader = false; //send Date: header
@@ -81,12 +72,6 @@
 
 
 	/* ------------------------------------------------------------ */
-	public Server()
-	{
-		setServer(this);
-	}
-
-	/* ------------------------------------------------------------ */
 	/** Convenience constructor
 	 * Creates server and a {@link SelectChannelConnector} at the passed port.
 	 */
@@ -97,20 +82,9 @@
 		Connector connector=new SelectChannelConnector();
 		connector.setPort(port);
 		setConnectors(new Connector[]{connector});
-	}
 
-	/* ------------------------------------------------------------ */
-	/** Convenience constructor
-	 * Creates server and a {@link SelectChannelConnector} at the passed address.
-	 */
-	public Server(InetSocketAddress addr)
-	{
-		setServer(this);
-
-		Connector connector=new SelectChannelConnector();
-		connector.setHost(addr.getHostName());
-		connector.setPort(addr.getPort());
-		setConnectors(new Connector[]{connector});
+		_threadPool = new QueuedThreadPool();
+		addBean(_threadPool);
 	}
 
 
@@ -196,19 +170,6 @@
 		return _threadPool;
 	}
 
-	/* ------------------------------------------------------------ */
-	/**
-	 * @param threadPool The threadPool to set.
-	 */
-	public void setThreadPool(ThreadPool threadPool)
-	{
-		if (_threadPool!=null)
-			removeBean(_threadPool);
-		_threadPool = threadPool;
-		if (_threadPool!=null)
-			addBean(_threadPool);
-	}
-
 	/**
 	 * @return true if {@link #dumpStdErr()} is called after starting
 	 */
@@ -259,9 +220,6 @@
 		
 		MultiException mex=new MultiException();
 
-		if (_threadPool==null)
-			setThreadPool(new QueuedThreadPool());
-
 		try
 		{
 			super.doStart();
@@ -450,63 +408,6 @@
 	}
 
 	/* ------------------------------------------------------------ */
-	/**
-	 * Add a LifeCycle object to be started/stopped
-	 * along with the Server.
-	 * @deprecated Use {@link #addBean(Object)}
-	 * @param c
-	 */
-	@Deprecated
-	public void addLifeCycle (LifeCycle c)
-	{
-		addBean(c);
-	}
-
-	/* ------------------------------------------------------------ */
-	/**
-	 * Add an associated bean.
-	 * The bean will be added to the servers {@link Container}
-	 * and if it is a {@link LifeCycle} instance, it will be
-	 * started/stopped along with the Server. Any beans that are also
-	 * {@link Destroyable}, will be destroyed with the server.
-	 * @param o the bean object to add
-	 */
-	@Override
-	public boolean addBean(Object o)
-	{
-		if (super.addBean(o))
-		{
-			return true;
-		}
-		return false;
-	}
-
-	/**
-	 * Remove a LifeCycle object to be started/stopped
-	 * along with the Server
-	 * @deprecated Use {@link #removeBean(Object)}
-	 */
-	@Deprecated
-	public void removeLifeCycle (LifeCycle c)
-	{
-		removeBean(c);
-	}
-
-	/* ------------------------------------------------------------ */
-	/**
-	 * Remove an associated bean.
-	 */
-	@Override
-	public boolean removeBean (Object o)
-	{
-		if (super.removeBean(o))
-		{
-			return true;
-		}
-		return false;
-	}
-
-	/* ------------------------------------------------------------ */
 	/*
 	 * @see org.eclipse.util.AttributesMap#clearAttributes()
 	 */