Removed unnecessary field.

This commit is contained in:
Simone Bordet 2015-08-20 15:15:06 +02:00
parent 837a36e3ec
commit 9b6ba2477c

View File

@ -23,7 +23,6 @@ import java.net.InetSocketAddress;
import java.net.Socket; import java.net.Socket;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.nio.channels.ByteChannel; import java.nio.channels.ByteChannel;
import java.nio.channels.GatheringByteChannel;
import java.nio.channels.SocketChannel; import java.nio.channels.SocketChannel;
import org.eclipse.jetty.util.BufferUtil; import org.eclipse.jetty.util.BufferUtil;
@ -39,9 +38,8 @@ public class ChannelEndPoint extends AbstractEndPoint
{ {
private static final Logger LOG = Log.getLogger(ChannelEndPoint.class); private static final Logger LOG = Log.getLogger(ChannelEndPoint.class);
private final ByteChannel _channel; private final SocketChannel _channel;
private final Socket _socket; private final Socket _socket;
private final GatheringByteChannel _gathering;
private volatile boolean _ishut; private volatile boolean _ishut;
private volatile boolean _oshut; private volatile boolean _oshut;
@ -50,9 +48,8 @@ public class ChannelEndPoint extends AbstractEndPoint
super(scheduler, super(scheduler,
(InetSocketAddress)channel.socket().getLocalSocketAddress(), (InetSocketAddress)channel.socket().getLocalSocketAddress(),
(InetSocketAddress)channel.socket().getRemoteSocketAddress()); (InetSocketAddress)channel.socket().getRemoteSocketAddress());
_channel = channel; _channel=channel;
_socket=channel.socket(); _socket=channel.socket();
_gathering=_channel instanceof GatheringByteChannel?((GatheringByteChannel)_channel):null;
} }
@Override @Override
@ -171,13 +168,13 @@ public class ChannelEndPoint extends AbstractEndPoint
@Override @Override
public boolean flush(ByteBuffer... buffers) throws IOException public boolean flush(ByteBuffer... buffers) throws IOException
{ {
int flushed=0; long flushed=0;
try try
{ {
if (buffers.length==1) if (buffers.length==1)
flushed=_channel.write(buffers[0]); flushed=_channel.write(buffers[0]);
else if (_gathering!=null && buffers.length>1) else if (buffers.length>1)
flushed= (int)_gathering.write(buffers,0,buffers.length); flushed=_channel.write(buffers,0,buffers.length);
else else
{ {
for (ByteBuffer b : buffers) for (ByteBuffer b : buffers)