Skip to content

Commit

Permalink
Merge pull request netty#515 from jfallows/master
Browse files Browse the repository at this point in the history
Add support for AIO server channel accepting new channels onto a separate child event loop group. See netty#514.
  • Loading branch information
normanmaurer committed Aug 14, 2012
2 parents 1f14036 + 148e629 commit 8b66e65
Showing 1 changed file with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public class AioServerSocketChannel extends AbstractAioChannel implements Server
private static final InternalLogger logger =
InternalLoggerFactory.getInstance(AioServerSocketChannel.class);

private final AioEventLoopGroup childGroup;
private final AioServerSocketChannelConfig config;
private boolean closed;
private AtomicBoolean readSuspended = new AtomicBoolean();
Expand All @@ -60,9 +61,14 @@ private static AsynchronousServerSocketChannel newSocket(AsynchronousChannelGrou
}
}

public AioServerSocketChannel(AioEventLoopGroup eventLoop) {
super(null, null, eventLoop, newSocket(eventLoop.group));
config = new AioServerSocketChannelConfig(javaChannel());
public AioServerSocketChannel(AioEventLoopGroup group) {
this(group, group);
}

public AioServerSocketChannel(AioEventLoopGroup parentGroup, AioEventLoopGroup childGroup) {
super(null, null, parentGroup, newSocket(parentGroup.group));
this.childGroup = childGroup;
this.config = new AioServerSocketChannelConfig(javaChannel());
}

@Override
Expand Down Expand Up @@ -147,7 +153,7 @@ protected void completed0(AsynchronousSocketChannel ch, AioServerSocketChannel c

// create the socket add it to the buffer and fire the event
channel.pipeline().inboundMessageBuffer().add(
new AioSocketChannel(channel, null, channel.group, ch));
new AioSocketChannel(channel, null, channel.childGroup, ch));
if (!channel.readSuspended.get()) {
channel.pipeline().fireInboundBufferUpdated();
}
Expand Down

0 comments on commit 8b66e65

Please sign in to comment.