11package com .beowulfe .hap .impl .http .impl ;
22
33import io .netty .bootstrap .ServerBootstrap ;
4- import io .netty .channel .ChannelFuture ;
5- import io .netty .channel .ChannelOption ;
6- import io .netty .channel .EventLoopGroup ;
4+ import io .netty .channel .*;
75import io .netty .channel .group .ChannelGroup ;
86import io .netty .channel .group .DefaultChannelGroup ;
97import io .netty .channel .nio .NioEventLoopGroup ;
108import io .netty .channel .socket .nio .NioServerSocketChannel ;
119import io .netty .handler .logging .LogLevel ;
1210import io .netty .handler .logging .LoggingHandler ;
13- import io .netty .util .concurrent .Future ;
14- import io .netty .util .concurrent .GenericFutureListener ;
15- import io .netty .util .concurrent .GlobalEventExecutor ;
11+ import io .netty .util .concurrent .*;
1612
1713import java .net .InetSocketAddress ;
1814import java .net .SocketAddress ;
@@ -29,20 +25,12 @@ class NettyHomekitHttpService {
2925 private final EventLoopGroup workerGroup ;
3026
3127 private final static Logger logger = LoggerFactory .getLogger (NettyHomekitHttpService .class );
32- private volatile static NettyHomekitHttpService INSTANCE ;
3328 private final ChannelGroup allChannels = new DefaultChannelGroup (GlobalEventExecutor .INSTANCE );
3429 private final int port ;
3530 private final int nThreads ;
3631
37- public static NettyHomekitHttpService get (int port , int nThreads ) {
38- if (INSTANCE == null ) {
39- synchronized (NettyHomekitHttpService .class ) {
40- if (INSTANCE == null ) {
41- INSTANCE = new NettyHomekitHttpService (port , nThreads );
42- }
43- }
44- }
45- return INSTANCE ;
32+ public static NettyHomekitHttpService create (int port , int nThreads ) {
33+ return new NettyHomekitHttpService (port , nThreads );
4634 }
4735
4836 private NettyHomekitHttpService (int port , int nThreads ) {
0 commit comments