Implement the right interfaces

This commit is contained in:
Norman Maurer 2012-06-17 11:07:21 +02:00
parent 5d1e710adc
commit 22bc8fecca
2 changed files with 7 additions and 3 deletions

View File

@ -18,7 +18,7 @@ package io.netty.channel.socket.aio;
import io.netty.buffer.ChannelBufType; import io.netty.buffer.ChannelBufType;
import io.netty.channel.ChannelException; import io.netty.channel.ChannelException;
import io.netty.channel.ChannelFuture; import io.netty.channel.ChannelFuture;
import io.netty.channel.ServerChannel; import io.netty.channel.socket.ServerSocketChannel;
import io.netty.logging.InternalLogger; import io.netty.logging.InternalLogger;
import io.netty.logging.InternalLoggerFactory; import io.netty.logging.InternalLoggerFactory;
@ -29,7 +29,7 @@ import java.nio.channels.AsynchronousServerSocketChannel;
import java.nio.channels.AsynchronousSocketChannel; import java.nio.channels.AsynchronousSocketChannel;
import java.nio.channels.CompletionHandler; import java.nio.channels.CompletionHandler;
public class AioServerSocketChannel extends AbstractAioChannel implements ServerChannel { public class AioServerSocketChannel extends AbstractAioChannel implements ServerSocketChannel {
private static final AcceptHandler ACCEPT_HANDLER = new AcceptHandler(); private static final AcceptHandler ACCEPT_HANDLER = new AcceptHandler();
private static final InternalLogger logger = private static final InternalLogger logger =

View File

@ -22,6 +22,7 @@ import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelPipeline; import io.netty.channel.ChannelPipeline;
import io.netty.channel.ChannelStateHandler; import io.netty.channel.ChannelStateHandler;
import io.netty.channel.ChannelStateHandlerAdapter; import io.netty.channel.ChannelStateHandlerAdapter;
import io.netty.channel.socket.SocketChannel;
import java.io.IOException; import java.io.IOException;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
@ -32,7 +33,7 @@ import java.nio.channels.AsynchronousSocketChannel;
import java.nio.channels.CompletionHandler; import java.nio.channels.CompletionHandler;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
public class AioSocketChannel extends AbstractAioChannel { public class AioSocketChannel extends AbstractAioChannel implements SocketChannel {
private static final CompletionHandler<Void, AioSocketChannel> CONNECT_HANDLER = new ConnectHandler(); private static final CompletionHandler<Void, AioSocketChannel> CONNECT_HANDLER = new ConnectHandler();
private static final CompletionHandler<Integer, AioSocketChannel> READ_HANDLER = new ReadHandler(); private static final CompletionHandler<Integer, AioSocketChannel> READ_HANDLER = new ReadHandler();
@ -73,6 +74,9 @@ public class AioSocketChannel extends AbstractAioChannel {
@Override @Override
public boolean isActive() { public boolean isActive() {
if (ch == null) {
return false;
}
AsynchronousSocketChannel ch = javaChannel(); AsynchronousSocketChannel ch = javaChannel();
return ch.isOpen() && remoteAddress() != null; return ch.isOpen() && remoteAddress() != null;
} }