1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package io.netty.channel.epoll;
17
18 import io.netty.channel.DefaultSelectStrategyFactory;
19 import io.netty.channel.EventLoopGroup;
20 import io.netty.channel.EventLoopTaskQueueFactory;
21 import io.netty.channel.IoEventLoop;
22 import io.netty.channel.IoHandlerFactory;
23 import io.netty.channel.MultiThreadIoEventLoopGroup;
24 import io.netty.channel.SelectStrategyFactory;
25 import io.netty.channel.SingleThreadEventLoop;
26 import io.netty.util.concurrent.EventExecutorChooserFactory;
27 import io.netty.util.concurrent.RejectedExecutionHandler;
28 import io.netty.util.concurrent.RejectedExecutionHandlers;
29
30 import java.util.concurrent.Executor;
31 import java.util.concurrent.ThreadFactory;
32
33
34
35
36
37
38
39 @Deprecated
40 public final class EpollEventLoopGroup extends MultiThreadIoEventLoopGroup {
41
42
43
44 {
45
46 Epoll.ensureAvailability();
47 }
48
49
50
51
52 public EpollEventLoopGroup() {
53 this(0);
54 }
55
56
57
58
59 public EpollEventLoopGroup(int nThreads) {
60 this(nThreads, (ThreadFactory) null);
61 }
62
63
64
65
66 @SuppressWarnings("deprecation")
67 public EpollEventLoopGroup(ThreadFactory threadFactory) {
68 this(0, threadFactory, 0);
69 }
70
71
72
73
74 @SuppressWarnings("deprecation")
75 public EpollEventLoopGroup(int nThreads, SelectStrategyFactory selectStrategyFactory) {
76 this(nThreads, (ThreadFactory) null, selectStrategyFactory);
77 }
78
79
80
81
82 @SuppressWarnings("deprecation")
83 public EpollEventLoopGroup(int nThreads, ThreadFactory threadFactory) {
84 this(nThreads, threadFactory, 0);
85 }
86
87 public EpollEventLoopGroup(int nThreads, Executor executor) {
88 this(nThreads, executor, DefaultSelectStrategyFactory.INSTANCE);
89 }
90
91
92
93
94 @SuppressWarnings("deprecation")
95 public EpollEventLoopGroup(int nThreads, ThreadFactory threadFactory, SelectStrategyFactory selectStrategyFactory) {
96 this(nThreads, threadFactory, 0, selectStrategyFactory);
97 }
98
99
100
101
102
103
104
105 @Deprecated
106 public EpollEventLoopGroup(int nThreads, ThreadFactory threadFactory, int maxEventsAtOnce) {
107 this(nThreads, threadFactory, maxEventsAtOnce, DefaultSelectStrategyFactory.INSTANCE);
108 }
109
110
111
112
113
114
115
116
117 @Deprecated
118 public EpollEventLoopGroup(int nThreads, ThreadFactory threadFactory, int maxEventsAtOnce,
119 SelectStrategyFactory selectStrategyFactory) {
120 super(nThreads, threadFactory, EpollIoHandler.newFactory(maxEventsAtOnce, selectStrategyFactory),
121 RejectedExecutionHandlers.reject());
122 }
123
124 public EpollEventLoopGroup(int nThreads, Executor executor, SelectStrategyFactory selectStrategyFactory) {
125 super(nThreads, executor, EpollIoHandler.newFactory(0, selectStrategyFactory),
126 RejectedExecutionHandlers.reject());
127 }
128
129 public EpollEventLoopGroup(int nThreads, Executor executor, EventExecutorChooserFactory chooserFactory,
130 SelectStrategyFactory selectStrategyFactory) {
131 super(nThreads, executor, EpollIoHandler.newFactory(0, selectStrategyFactory), chooserFactory,
132 RejectedExecutionHandlers.reject());
133 }
134
135 public EpollEventLoopGroup(int nThreads, Executor executor, EventExecutorChooserFactory chooserFactory,
136 SelectStrategyFactory selectStrategyFactory,
137 RejectedExecutionHandler rejectedExecutionHandler) {
138 super(nThreads, executor, EpollIoHandler.newFactory(0, selectStrategyFactory), chooserFactory,
139 rejectedExecutionHandler);
140 }
141
142 public EpollEventLoopGroup(int nThreads, Executor executor, EventExecutorChooserFactory chooserFactory,
143 SelectStrategyFactory selectStrategyFactory,
144 RejectedExecutionHandler rejectedExecutionHandler,
145 EventLoopTaskQueueFactory queueFactory) {
146 super(nThreads, executor, EpollIoHandler.newFactory(0, selectStrategyFactory), chooserFactory,
147 rejectedExecutionHandler, queueFactory);
148 }
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163 public EpollEventLoopGroup(int nThreads, Executor executor, EventExecutorChooserFactory chooserFactory,
164 SelectStrategyFactory selectStrategyFactory,
165 RejectedExecutionHandler rejectedExecutionHandler,
166 EventLoopTaskQueueFactory taskQueueFactory,
167 EventLoopTaskQueueFactory tailTaskQueueFactory) {
168 super(nThreads, executor, EpollIoHandler.newFactory(0, selectStrategyFactory),
169 chooserFactory, rejectedExecutionHandler, taskQueueFactory, tailTaskQueueFactory);
170 }
171
172 @Override
173 protected IoEventLoop newChild(Executor executor, IoHandlerFactory ioHandlerFactory, Object... args) {
174 RejectedExecutionHandler rejectedExecutionHandler = (RejectedExecutionHandler) args[0];
175 EventLoopTaskQueueFactory taskQueueFactory = null;
176 EventLoopTaskQueueFactory tailTaskQueueFactory = null;
177
178 int argsLength = args.length;
179 if (argsLength > 1) {
180 taskQueueFactory = (EventLoopTaskQueueFactory) args[1];
181 }
182 if (argsLength > 2) {
183 tailTaskQueueFactory = (EventLoopTaskQueueFactory) args[2];
184 }
185 return new EpollEventLoop(this, executor, ioHandlerFactory, taskQueueFactory, tailTaskQueueFactory,
186 rejectedExecutionHandler);
187 }
188 }