File tree Expand file tree Collapse file tree 2 files changed +6
-6
lines changed
src/main/java/cn/ipman/cache Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change 2
2
3
3
import org .springframework .boot .SpringApplication ;
4
4
import org .springframework .boot .autoconfigure .SpringBootApplication ;
5
+ import org .springframework .scheduling .annotation .EnableAsync ;
5
6
6
7
@ SpringBootApplication
8
+ @ EnableAsync
7
9
public class CacheManApplication {
8
10
9
11
public static void main (String [] args ) {
Original file line number Diff line number Diff line change 2
2
3
3
import io .netty .bootstrap .ServerBootstrap ;
4
4
import io .netty .buffer .PooledByteBufAllocator ;
5
- import io .netty .channel .Channel ;
6
- import io .netty .channel .ChannelInitializer ;
7
- import io .netty .channel .ChannelOption ;
8
- import io .netty .channel .EventLoopGroup ;
5
+ import io .netty .channel .*;
9
6
import io .netty .channel .epoll .EpollChannelOption ;
10
7
import io .netty .channel .nio .NioEventLoopGroup ;
11
8
import io .netty .channel .socket .SocketChannel ;
12
9
import io .netty .channel .socket .nio .NioServerSocketChannel ;
13
10
import io .netty .handler .logging .LogLevel ;
14
11
import io .netty .handler .logging .LoggingHandler ;
15
12
import io .netty .util .concurrent .DefaultThreadFactory ;
13
+ import org .springframework .scheduling .annotation .Async ;
16
14
import org .springframework .stereotype .Component ;
17
15
18
16
/**
@@ -35,6 +33,7 @@ public void init() {
35
33
workerGroup = new NioEventLoopGroup (16 , new DefaultThreadFactory ("redis-work" ));
36
34
}
37
35
36
+ @ Async
38
37
@ Override
39
38
public void startup () {
40
39
try {
@@ -65,8 +64,7 @@ protected void initChannel(SocketChannel ch) {
65
64
} catch (Exception e ) {
66
65
throw new RuntimeException (e );
67
66
} finally {
68
- bossGroup .shutdownGracefully ();
69
- workerGroup .shutdownGracefully ();
67
+ shutdown ();
70
68
}
71
69
}
72
70
You can’t perform that action at this time.
0 commit comments