diff src/org/eclipse/jetty/io/nio/ChannelEndPoint.java @ 960:3cd4c706a61f

simplify ChannelEndPoint
author Franklin Schmidt <fschmidt@gmail.com>
date Thu, 13 Oct 2016 21:29:19 -0600
parents fc521d2f098e
children 866f2e801618
line wrap: on
line diff
--- a/src/org/eclipse/jetty/io/nio/ChannelEndPoint.java	Thu Oct 13 18:53:26 2016 -0600
+++ b/src/org/eclipse/jetty/io/nio/ChannelEndPoint.java	Thu Oct 13 21:29:19 2016 -0600
@@ -52,68 +52,49 @@
 	private volatile boolean _ishut;
 	private volatile boolean _oshut;
 
-	public ChannelEndPoint(ByteChannel channel) throws IOException
-	{
-		super();
-		this._channel = channel;
-		_socket=(channel instanceof SocketChannel)?((SocketChannel)channel).socket():null;
-		if (_socket!=null)
-		{
-			_local=(InetSocketAddress)_socket.getLocalSocketAddress();
-			_remote=(InetSocketAddress)_socket.getRemoteSocketAddress();
-			_maxIdleTime=_socket.getSoTimeout();
-		}
-		else
-		{
-			_local=_remote=null;
-		}
-	}
-
 	protected ChannelEndPoint(ByteChannel channel, int maxIdleTime) throws IOException
 	{
 		this._channel = channel;
-		_maxIdleTime=maxIdleTime;
-		_socket=(channel instanceof SocketChannel)?((SocketChannel)channel).socket():null;
+		_maxIdleTime = maxIdleTime;
+		_socket = (channel instanceof SocketChannel)?((SocketChannel)channel).socket():null;
 		if (_socket!=null)
 		{
-			_local=(InetSocketAddress)_socket.getLocalSocketAddress();
-			_remote=(InetSocketAddress)_socket.getRemoteSocketAddress();
+			_local = (InetSocketAddress)_socket.getLocalSocketAddress();
+			_remote = (InetSocketAddress)_socket.getRemoteSocketAddress();
 			_socket.setSoTimeout(_maxIdleTime);
 		}
 		else
 		{
-			_local=_remote=null;
+			_local = _remote = null;
 		}
 	}
 
-	public boolean isBlocking()
+	@Override
+	public final boolean isBlocking()
 	{
 		return  !(_channel instanceof SelectableChannel) || ((SelectableChannel)_channel).isBlocking();
 	}
 
+	@Override
 	public boolean blockReadable(long millisecs) throws IOException
 	{
 		return true;
 	}
 
+	@Override
 	public boolean blockWritable(long millisecs) throws IOException
 	{
 		return true;
 	}
 
-	/*
-	 * @see org.eclipse.io.EndPoint#isOpen()
-	 */
-	public boolean isOpen()
+	@Override
+	public final boolean isOpen()
 	{
 		return _channel.isOpen();
 	}
 
-	/** Shutdown the channel Input.
-	 * Cannot be overridden. To override, see {@link #shutdownInput()}
-	 * @throws IOException
-	 */
-	protected final void shutdownChannelInput() throws IOException
+	@Override
+	public final void shutdownInput() throws IOException
 	{
 		LOG.debug("ishut {}", this);
 		_ishut = true;
@@ -144,15 +125,8 @@
 		}
 	}
 
-	/* (non-Javadoc)
-	 * @see org.eclipse.io.EndPoint#close()
-	 */
-	public void shutdownInput() throws IOException
-	{
-		shutdownChannelInput();
-	}
-
-	protected final void shutdownChannelOutput() throws IOException
+	@Override
+	public final void shutdownOutput() throws IOException
 	{
 		LOG.debug("oshut {}",this);
 		_oshut = true;
@@ -183,27 +157,19 @@
 		}
 	}
 
-	/* (non-Javadoc)
-	 * @see org.eclipse.io.EndPoint#close()
-	 */
-	public void shutdownOutput() throws IOException
-	{
-		shutdownChannelOutput();
-	}
-
-	public boolean isOutputShutdown()
+	@Override
+	public final boolean isOutputShutdown()
 	{
 		return _oshut || !_channel.isOpen() || _socket != null && _socket.isOutputShutdown();
 	}
 
-	public boolean isInputShutdown()
+	@Override
+	public final boolean isInputShutdown()
 	{
 		return _ishut || !_channel.isOpen() || _socket != null && _socket.isInputShutdown();
 	}
 
-	/* (non-Javadoc)
-	 * @see org.eclipse.io.EndPoint#close()
-	 */
+	@Override
 	public void close() throws IOException
 	{
 		LOG.debug("close {}",this);