diff src/org/eclipse/jetty/server/Connector.java @ 996:d9cfec64899c

simplify Connector
author Franklin Schmidt <fschmidt@gmail.com>
date Tue, 18 Oct 2016 21:22:53 -0600
parents 5ee36654b383
children 39154cfa58e4
line wrap: on
line diff
--- a/src/org/eclipse/jetty/server/Connector.java	Tue Oct 18 18:38:05 2016 -0600
+++ b/src/org/eclipse/jetty/server/Connector.java	Tue Oct 18 21:22:53 2016 -0600
@@ -71,7 +71,7 @@
 	// from child classes
 	protected transient ServerSocketChannel _acceptChannel;
 
-	public Connector(Server server,int port) {
+	protected Connector(Server server,int port) {
 		this.server = server;
 		this.port = port;
 		server.connectors.add(this);
@@ -82,17 +82,17 @@
 		_buffers.setResponseHeaderType(Type.INDIRECT);
 	}
 
-	public void setHost(String host)
+	public final void setHost(String host)
 	{
 		_host = host;
 	}
 
-	public String getHost()
+	public final String getHost()
 	{
 		return _host;
 	}
 
-	public int getMaxIdleTime()
+	public final int getMaxIdleTime()
 	{
 		return _maxIdleTime;
 	}
@@ -124,11 +124,7 @@
 	}
 */
 
-	/* ------------------------------------------------------------ */
-	/**
-	 * @return Returns the soLingerTime.
-	 */
-	public int getSoLingerTime()
+	public final int getSoLingerTime()
 	{
 		return _soLingerTime;
 	}
@@ -138,7 +134,7 @@
 	 * @param soLingerTime
 	 *            The soLingerTime to set or -1 to disable.
 	 */
-	public void setSoLingerTime(int soLingerTime)
+	public final void setSoLingerTime(int soLingerTime)
 	{
 		_soLingerTime = soLingerTime;
 	}
@@ -184,9 +180,7 @@
 			socket.setSoLinger(false,0);
 	}
 
-	public void customize(EndPoint endpoint, Request request) throws IOException
-	{
-	}
+	public abstract void customize(EndPoint endpoint, Request request) throws IOException;
 
 	public boolean isConfidential()
 	{
@@ -195,91 +189,104 @@
 
 	protected abstract void accept() throws IOException, InterruptedException;
 
-	public void stopAccept(int acceptorID) throws Exception
-	{
-	}
-
-	public int getRequestBufferSize()
+	@Override
+	public final int getRequestBufferSize()
 	{
 		return _buffers.getRequestBufferSize();
 	}
 
-	public void setRequestBufferSize(int requestBufferSize)
+	@Override
+	public final void setRequestBufferSize(int requestBufferSize)
 	{
 		_buffers.setRequestBufferSize(requestBufferSize);
 	}
 
-	public int getRequestHeaderSize()
+	@Override
+	public final int getRequestHeaderSize()
 	{
 		return _buffers.getRequestHeaderSize();
 	}
 
-	public void setRequestHeaderSize(int requestHeaderSize)
+	@Override
+	public final void setRequestHeaderSize(int requestHeaderSize)
 	{
 		_buffers.setRequestHeaderSize(requestHeaderSize);
 	}
 
-	public int getResponseBufferSize()
+	@Override
+	public final int getResponseBufferSize()
 	{
 		return _buffers.getResponseBufferSize();
 	}
 
-	public void setResponseBufferSize(int responseBufferSize)
+	@Override
+	public final void setResponseBufferSize(int responseBufferSize)
 	{
 		_buffers.setResponseBufferSize(responseBufferSize);
 	}
 
-	public int getResponseHeaderSize()
+	@Override
+	public final int getResponseHeaderSize()
 	{
 		return _buffers.getResponseHeaderSize();
 	}
 
-	public void setResponseHeaderSize(int responseHeaderSize)
+	@Override
+	public final void setResponseHeaderSize(int responseHeaderSize)
 	{
 		_buffers.setResponseHeaderSize(responseHeaderSize);
 	}
 
-	public Type getRequestBufferType()
+	@Override
+	public final Type getRequestBufferType()
 	{
 		return _buffers.getRequestBufferType();
 	}
 
-	public Type getRequestHeaderType()
+	@Override
+	public final Type getRequestHeaderType()
 	{
 		return _buffers.getRequestHeaderType();
 	}
 
-	public Type getResponseBufferType()
+	@Override
+	public final Type getResponseBufferType()
 	{
 		return _buffers.getResponseBufferType();
 	}
 
-	public Type getResponseHeaderType()
+	@Override
+	public final Type getResponseHeaderType()
 	{
 		return _buffers.getResponseHeaderType();
 	}
 
-	public void setRequestBuffers(Buffers requestBuffers)
+	@Override
+	public final void setRequestBuffers(Buffers requestBuffers)
 	{
 		_buffers.setRequestBuffers(requestBuffers);
 	}
 
-	public void setResponseBuffers(Buffers responseBuffers)
+	@Override
+	public final void setResponseBuffers(Buffers responseBuffers)
 	{
 		_buffers.setResponseBuffers(responseBuffers);
 	}
 
-	public Buffers getRequestBuffers()
+	@Override
+	public final Buffers getRequestBuffers()
 	{
 		return _buffers.getRequestBuffers();
 	}
 
-	public Buffers getResponseBuffers()
+	@Override
+	public final Buffers getResponseBuffers()
 	{
 		return _buffers.getResponseBuffers();
 	}
 
-	public int getMaxBuffers()
+	@Override
+	public final int getMaxBuffers()
 	{
 		return _buffers.getMaxBuffers();
 	}
@@ -294,6 +301,7 @@
 	}
 
 
+	@Override
 	public void run()
 	{
 		Thread current = Thread.currentThread();
@@ -333,23 +341,17 @@
 		}
 	}
 
-	public String getName()
+	public final String getName()
 	{
 		if (_name == null)
 			_name = (getHost() == null?"0.0.0.0":getHost()) + ":" + port;
 		return _name;
 	}
 
-	public final boolean isLowResources()
-	{
-		return server.isLowOnThreads();
-	}
-
 
 	// from AbstractNIOConnector
 
-	/* ------------------------------------------------------------------------------- */
-	public boolean getUseDirectBuffers()
+	public final boolean getUseDirectBuffers()
 	{
 		return getRequestBufferType()==Type.DIRECT;
 	}
@@ -359,13 +361,10 @@
 	 * @param direct If True (the default), the connector can use NIO direct buffers.
 	 * Some JVMs have memory management issues (bugs) with direct buffers.
 	 */
-	public void setUseDirectBuffers(boolean direct)
+	public final void setUseDirectBuffers(boolean direct)
 	{
 		_buffers.setRequestBufferType(direct?Type.DIRECT:Type.INDIRECT);
 		_buffers.setResponseBufferType(direct?Type.DIRECT:Type.INDIRECT);
 	}
 
-
-	// from child classes
-
 }