diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2018-06-02 22:12:44 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2018-06-02 22:12:44 +1200 |
commit | 06e3bd8b16da12baafc9a97ba5949b3f7ffb5e07 (patch) | |
tree | 8f5d7b71ca3fa39448e93b3d0652a7fa8d496932 /src/org/traccar/GlobalChannelFactory.java | |
parent | 5a9811c3771d92832c9bba718b5ec935844978e8 (diff) | |
download | trackermap-server-06e3bd8b16da12baafc9a97ba5949b3f7ffb5e07.tar.gz trackermap-server-06e3bd8b16da12baafc9a97ba5949b3f7ffb5e07.tar.bz2 trackermap-server-06e3bd8b16da12baafc9a97ba5949b3f7ffb5e07.zip |
Start Netty 4 migration
Diffstat (limited to 'src/org/traccar/GlobalChannelFactory.java')
-rw-r--r-- | src/org/traccar/GlobalChannelFactory.java | 40 |
1 files changed, 9 insertions, 31 deletions
diff --git a/src/org/traccar/GlobalChannelFactory.java b/src/org/traccar/GlobalChannelFactory.java index c5cd1a697..7bc0f4f03 100644 --- a/src/org/traccar/GlobalChannelFactory.java +++ b/src/org/traccar/GlobalChannelFactory.java @@ -15,42 +15,20 @@ */ package org.traccar; -import org.jboss.netty.channel.ChannelFactory; -import org.jboss.netty.channel.socket.DatagramChannelFactory; -import org.jboss.netty.channel.socket.nio.NioDatagramChannelFactory; -import org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory; +import io.netty.channel.EventLoopGroup; +import io.netty.channel.nio.NioEventLoopGroup; -public final class GlobalChannelFactory { +public final class GlobalChannelFactory { // TODO rename class - private static ChannelFactory channelFactory = null; - private static DatagramChannelFactory datagramChannelFactory = null; + private static EventLoopGroup bossGroup = new NioEventLoopGroup(); + private static EventLoopGroup workerGroup = new NioEventLoopGroup(); - private GlobalChannelFactory() { + public static EventLoopGroup getBossGroup() { + return bossGroup; } - public static void release() { - if (channelFactory != null) { - channelFactory.releaseExternalResources(); - } - if (datagramChannelFactory != null) { - datagramChannelFactory.releaseExternalResources(); - } - channelFactory = null; - datagramChannelFactory = null; - } - - public static ChannelFactory getFactory() { - if (channelFactory == null) { - channelFactory = new NioServerSocketChannelFactory(); - } - return channelFactory; - } - - public static DatagramChannelFactory getDatagramFactory() { - if (datagramChannelFactory == null) { - datagramChannelFactory = new NioDatagramChannelFactory(); - } - return datagramChannelFactory; + public static EventLoopGroup getWorkerGroup() { + return workerGroup; } } |