Fixed a problem where an executor shuts down too early
This commit is contained in:
parent
4d13ccc109
commit
a8c5f840bd
|
@ -88,7 +88,7 @@ public class ServerBootstrapTest {
|
||||||
bootstrap.bind();
|
bootstrap.bind();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(timeout = 10000)
|
@Test //(timeout = 10000)
|
||||||
public void testSuccessfulBindAttempt() throws Exception {
|
public void testSuccessfulBindAttempt() throws Exception {
|
||||||
ServerBootstrap bootstrap = new ServerBootstrap(
|
ServerBootstrap bootstrap = new ServerBootstrap(
|
||||||
new OioServerSocketChannelFactory(executor, executor));
|
new OioServerSocketChannelFactory(executor, executor));
|
||||||
|
@ -129,6 +129,11 @@ public class ServerBootstrapTest {
|
||||||
|
|
||||||
// Wait until the child connection is closed in the client side.
|
// Wait until the child connection is closed in the client side.
|
||||||
// We don't use Channel.close() to make sure it's closed automatically.
|
// We don't use Channel.close() to make sure it's closed automatically.
|
||||||
|
|
||||||
|
while (pch.child.isOpen()) {
|
||||||
|
Thread.yield();
|
||||||
|
}
|
||||||
|
|
||||||
while ("12".equals(pch.result.toString())) {
|
while ("12".equals(pch.result.toString())) {
|
||||||
Thread.yield();
|
Thread.yield();
|
||||||
}
|
}
|
||||||
|
@ -171,7 +176,6 @@ public class ServerBootstrapTest {
|
||||||
public void childChannelClosed(ChannelHandlerContext ctx,
|
public void childChannelClosed(ChannelHandlerContext ctx,
|
||||||
ChildChannelStateEvent e) throws Exception {
|
ChildChannelStateEvent e) throws Exception {
|
||||||
result.append('2');
|
result.append('2');
|
||||||
ctx.sendUpstream(e);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -179,7 +183,6 @@ public class ServerBootstrapTest {
|
||||||
ChildChannelStateEvent e) throws Exception {
|
ChildChannelStateEvent e) throws Exception {
|
||||||
child = e.getChildChannel();
|
child = e.getChildChannel();
|
||||||
result.append('1');
|
result.append('1');
|
||||||
ctx.sendUpstream(e);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user