mirror of
https://github.com/collinsmith/riiablo.git
synced 2025-07-09 15:28:18 +07:00
Moved EventLoopGroup shutdown to Application#dispose
This commit is contained in:
@ -38,12 +38,13 @@ public class TestClient extends ApplicationAdapter implements PacketProcessor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Endpoint<?> endpoint;
|
private Endpoint<?> endpoint;
|
||||||
|
private EventLoopGroup group;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void create() {
|
public void create() {
|
||||||
Gdx.app.setLogLevel(Application.LOG_DEBUG);
|
Gdx.app.setLogLevel(Application.LOG_DEBUG);
|
||||||
|
|
||||||
EventLoopGroup group = new NioEventLoopGroup();
|
group = new NioEventLoopGroup();
|
||||||
try {
|
try {
|
||||||
Bootstrap b = new Bootstrap()
|
Bootstrap b = new Bootstrap()
|
||||||
.group(group)
|
.group(group)
|
||||||
@ -64,8 +65,6 @@ public class TestClient extends ApplicationAdapter implements PacketProcessor {
|
|||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
Gdx.app.error(TAG, t.getMessage(), t);
|
Gdx.app.error(TAG, t.getMessage(), t);
|
||||||
Gdx.app.exit();
|
Gdx.app.exit();
|
||||||
} finally {
|
|
||||||
group.shutdownGracefully();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,6 +86,11 @@ public class TestClient extends ApplicationAdapter implements PacketProcessor {
|
|||||||
endpoint.update(Gdx.graphics.getDeltaTime());
|
endpoint.update(Gdx.graphics.getDeltaTime());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void dispose() {
|
||||||
|
if (!group.isShuttingDown()) group.shutdownGracefully();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void processPacket(ByteBuf bb) {
|
public void processPacket(ByteBuf bb) {
|
||||||
Gdx.app.debug(TAG, "Processing packet...");
|
Gdx.app.debug(TAG, "Processing packet...");
|
||||||
|
@ -38,12 +38,13 @@ public class TestServer extends ApplicationAdapter implements PacketProcessor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Endpoint<?> endpoint;
|
private Endpoint<?> endpoint;
|
||||||
|
private EventLoopGroup group;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void create() {
|
public void create() {
|
||||||
Gdx.app.setLogLevel(Application.LOG_DEBUG);
|
Gdx.app.setLogLevel(Application.LOG_DEBUG);
|
||||||
|
|
||||||
EventLoopGroup group = new NioEventLoopGroup();
|
group = new NioEventLoopGroup();
|
||||||
try {
|
try {
|
||||||
Bootstrap b = new Bootstrap()
|
Bootstrap b = new Bootstrap()
|
||||||
.group(group)
|
.group(group)
|
||||||
@ -65,8 +66,6 @@ public class TestServer extends ApplicationAdapter implements PacketProcessor {
|
|||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
Gdx.app.error(TAG, t.getMessage(), t);
|
Gdx.app.error(TAG, t.getMessage(), t);
|
||||||
Gdx.app.exit();
|
Gdx.app.exit();
|
||||||
} finally {
|
|
||||||
group.shutdownGracefully();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -75,6 +74,11 @@ public class TestServer extends ApplicationAdapter implements PacketProcessor {
|
|||||||
endpoint.update(Gdx.graphics.getDeltaTime());
|
endpoint.update(Gdx.graphics.getDeltaTime());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void dispose() {
|
||||||
|
if (!group.isShuttingDown()) group.shutdownGracefully();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void processPacket(ByteBuf bb) {
|
public void processPacket(ByteBuf bb) {
|
||||||
Gdx.app.debug(TAG, "Processing packet...");
|
Gdx.app.debug(TAG, "Processing packet...");
|
||||||
|
@ -39,15 +39,16 @@ public class TestClient extends ApplicationAdapter implements PacketProcessor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Endpoint<?> endpoint;
|
private Endpoint<?> endpoint;
|
||||||
|
private EventLoopGroup group;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void create() {
|
public void create() {
|
||||||
Gdx.app.setLogLevel(Application.LOG_DEBUG);
|
Gdx.app.setLogLevel(Application.LOG_DEBUG);
|
||||||
|
|
||||||
EventLoopGroup workerGroup = new NioEventLoopGroup();
|
group = new NioEventLoopGroup();
|
||||||
try {
|
try {
|
||||||
Bootstrap b = new Bootstrap()
|
Bootstrap b = new Bootstrap()
|
||||||
.group(workerGroup)
|
.group(group)
|
||||||
.channel(NioSocketChannel.class)
|
.channel(NioSocketChannel.class)
|
||||||
.option(ChannelOption.SO_KEEPALIVE, true)
|
.option(ChannelOption.SO_KEEPALIVE, true)
|
||||||
.handler(new ChannelInitializer<SocketChannel>() {
|
.handler(new ChannelInitializer<SocketChannel>() {
|
||||||
@ -66,8 +67,6 @@ public class TestClient extends ApplicationAdapter implements PacketProcessor {
|
|||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
Gdx.app.error(TAG, t.getMessage(), t);
|
Gdx.app.error(TAG, t.getMessage(), t);
|
||||||
Gdx.app.exit();
|
Gdx.app.exit();
|
||||||
} finally {
|
|
||||||
workerGroup.shutdownGracefully();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -89,6 +88,11 @@ public class TestClient extends ApplicationAdapter implements PacketProcessor {
|
|||||||
endpoint.update(Gdx.graphics.getDeltaTime());
|
endpoint.update(Gdx.graphics.getDeltaTime());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void dispose() {
|
||||||
|
if (!group.isShuttingDown()) group.shutdownGracefully();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void processPacket(ByteBuf bb) {
|
public void processPacket(ByteBuf bb) {
|
||||||
Gdx.app.debug(TAG, "Processing packet...");
|
Gdx.app.debug(TAG, "Processing packet...");
|
||||||
|
@ -34,13 +34,15 @@ public class TestServer extends ApplicationAdapter implements PacketProcessor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Endpoint<?> endpoint;
|
private Endpoint<?> endpoint;
|
||||||
|
private EventLoopGroup bossGroup;
|
||||||
|
private EventLoopGroup workerGroup;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void create() {
|
public void create() {
|
||||||
Gdx.app.setLogLevel(Application.LOG_DEBUG);
|
Gdx.app.setLogLevel(Application.LOG_DEBUG);
|
||||||
|
|
||||||
EventLoopGroup bossGroup = new NioEventLoopGroup();
|
bossGroup = new NioEventLoopGroup();
|
||||||
EventLoopGroup workerGroup = new NioEventLoopGroup();
|
workerGroup = new NioEventLoopGroup();
|
||||||
try {
|
try {
|
||||||
ServerBootstrap b = new ServerBootstrap()
|
ServerBootstrap b = new ServerBootstrap()
|
||||||
.group(bossGroup, workerGroup)
|
.group(bossGroup, workerGroup)
|
||||||
@ -63,9 +65,6 @@ public class TestServer extends ApplicationAdapter implements PacketProcessor {
|
|||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
Gdx.app.error(TAG, t.getMessage(), t);
|
Gdx.app.error(TAG, t.getMessage(), t);
|
||||||
Gdx.app.exit();
|
Gdx.app.exit();
|
||||||
} finally {
|
|
||||||
workerGroup.shutdownGracefully();
|
|
||||||
bossGroup.shutdownGracefully();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -74,6 +73,12 @@ public class TestServer extends ApplicationAdapter implements PacketProcessor {
|
|||||||
endpoint.update(Gdx.graphics.getDeltaTime());
|
endpoint.update(Gdx.graphics.getDeltaTime());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void dispose() {
|
||||||
|
if (!workerGroup.isShuttingDown()) workerGroup.shutdownGracefully();
|
||||||
|
if (!bossGroup.isShuttingDown()) bossGroup.shutdownGracefully();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void processPacket(ByteBuf bb) {
|
public void processPacket(ByteBuf bb) {
|
||||||
Gdx.app.debug(TAG, "Processing packet...");
|
Gdx.app.debug(TAG, "Processing packet...");
|
||||||
|
Reference in New Issue
Block a user