changeset 973:4d9fe9cc554d

simplify AbstractConnection
author Franklin Schmidt <fschmidt@gmail.com>
date Sat, 15 Oct 2016 23:03:00 -0600
parents 5ee36654b383
children 7422ca1ae146
files src/org/eclipse/jetty/io/AbstractConnection.java src/org/eclipse/jetty/io/Connection.java src/org/eclipse/jetty/io/nio/SslConnection.java src/org/eclipse/jetty/server/BlockingHttpConnection.java
diffstat 4 files changed, 7 insertions(+), 78 deletions(-) [+]
line wrap: on
line diff
--- a/src/org/eclipse/jetty/io/AbstractConnection.java	Sat Oct 15 22:42:05 2016 -0600
+++ b/src/org/eclipse/jetty/io/AbstractConnection.java	Sat Oct 15 23:03:00 2016 -0600
@@ -28,56 +28,19 @@
 {
 	private static final Logger LOG = LoggerFactory.getLogger(AbstractConnection.class);
 
-	private final long _timeStamp;
 	protected final EndPoint _endp;
 
-	public AbstractConnection(EndPoint endp)
+	protected AbstractConnection(EndPoint endp)
 	{
-		_endp=(EndPoint)endp;
-		_timeStamp = System.currentTimeMillis();
+		_endp = endp;
 	}
 
-	public AbstractConnection(EndPoint endp,long timestamp)
-	{
-		_endp=(EndPoint)endp;
-		_timeStamp = timestamp;
-	}
-
-	public long getTimeStamp()
-	{
-		return _timeStamp;
-	}
-
-	public EndPoint getEndPoint()
+	public final EndPoint getEndPoint()
 	{
 		return _endp;
 	}
 
-	public void onIdleExpired(long idleForMs)
-	{
-		try
-		{
-			LOG.debug("onIdleExpired {}ms {} {}",idleForMs,this,_endp);
-			if (_endp.isInputShutdown() || _endp.isOutputShutdown())
-				_endp.close();
-			else
-				_endp.shutdownOutput();
-		}
-		catch(IOException e)
-		{
-			LOG.trace("",e);
-
-			try
-			{
-				_endp.close();
-			}
-			catch(IOException e2)
-			{
-				LOG.trace("",e2);
-			}
-		}
-	}
-
+	@Override
 	public String toString()
 	{
 		return String.format("%s@%x", getClass().getSimpleName(), hashCode());
--- a/src/org/eclipse/jetty/io/Connection.java	Sat Oct 15 22:42:05 2016 -0600
+++ b/src/org/eclipse/jetty/io/Connection.java	Sat Oct 15 23:03:00 2016 -0600
@@ -42,20 +42,8 @@
 	void handle() throws IOException;
 
 	/**
-	 * @return the timestamp at which the connection was created
-	 */
-	long getTimeStamp();
-
-	/**
 	 * @return whether this connection is idle, that is not parsing and not generating
 	 * @see #onIdleExpired(long)
 	 */
 	boolean isIdle();
-
-	/**
-	 * Called when the connection idle timeout expires
-	 * @param idleForMs how long the connection has been idle
-	 * @see #isIdle()
-	 */
-	void onIdleExpired(long idleForMs);
 }
--- a/src/org/eclipse/jetty/io/nio/SslConnection.java	Sat Oct 15 22:42:05 2016 -0600
+++ b/src/org/eclipse/jetty/io/nio/SslConnection.java	Sat Oct 15 23:03:00 2016 -0600
@@ -86,12 +86,7 @@
 
 	public SslConnection(SSLEngine engine,AsyncEndPoint endp)
 	{
-		this(engine,endp,System.currentTimeMillis());
-	}
-
-	private SslConnection(SSLEngine engine,AsyncEndPoint endp, long timeStamp)
-	{
-		super(endp,timeStamp);
+		super(endp);
 		_engine=engine;
 		_session=_engine.getSession();
 		_aEndp=endp;
@@ -221,24 +216,6 @@
 		return false;
 	}
 
-	@Override
-	public void onIdleExpired(long idleForMs)
-	{
-		try
-		{
-			_logger.debug("onIdleExpired {}ms on {}",idleForMs,this);
-			if (_endp.isOutputShutdown())
-				_sslEndPoint.close();
-			else
-				_sslEndPoint.shutdownOutput();
-		}
-		catch (IOException e)
-		{
-			_logger.warn("",e);
-			super.onIdleExpired(idleForMs);
-		}
-	}
-
 	public void onInputShutdown() throws IOException
 	{
 
--- a/src/org/eclipse/jetty/server/BlockingHttpConnection.java	Sat Oct 15 22:42:05 2016 -0600
+++ b/src/org/eclipse/jetty/server/BlockingHttpConnection.java	Sat Oct 15 23:03:00 2016 -0600
@@ -25,6 +25,7 @@
 import org.eclipse.jetty.http.HttpStatus;
 import org.eclipse.jetty.http.Parser;
 import org.eclipse.jetty.io.EndPoint;
+import org.eclipse.jetty.io.nio.ChannelEndPoint;
 import org.eclipse.jetty.server.nio.BlockingChannelConnector;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -37,7 +38,7 @@
 {
 	private static final Logger LOG = LoggerFactory.getLogger(BlockingHttpConnection.class);
 
-	public BlockingHttpConnection(BlockingChannelConnector connector, EndPoint endpoint)
+	public BlockingHttpConnection(BlockingChannelConnector connector, ChannelEndPoint endpoint)
 	{
 		super(connector,endpoint);
 	}