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.IoHandler;
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 import io.netty.util.internal.logging.InternalLogger;
30 import io.netty.util.internal.logging.InternalLoggerFactory;
31
32 import java.util.concurrent.Executor;
33 import java.util.concurrent.ThreadFactory;
34
35
36
37
38
39
40
41 @Deprecated
42 public final class EpollEventLoopGroup extends MultiThreadIoEventLoopGroup {
43
44
45
46 {
47
48 Epoll.ensureAvailability();
49 }
50 private static final InternalLogger LOGGER = InternalLoggerFactory.getInstance(EpollEventLoopGroup.class);
51
52
53
54
55 public EpollEventLoopGroup() {
56 this(0);
57 }
58
59
60
61
62 public EpollEventLoopGroup(int nThreads) {
63 this(nThreads, (ThreadFactory) null);
64 }
65
66
67
68
69 @SuppressWarnings("deprecation")
70 public EpollEventLoopGroup(ThreadFactory threadFactory) {
71 this(0, threadFactory, 0);
72 }
73
74
75
76
77 @SuppressWarnings("deprecation")
78 public EpollEventLoopGroup(int nThreads, SelectStrategyFactory selectStrategyFactory) {
79 this(nThreads, (ThreadFactory) null, selectStrategyFactory);
80 }
81
82
83
84
85 @SuppressWarnings("deprecation")
86 public EpollEventLoopGroup(int nThreads, ThreadFactory threadFactory) {
87 this(nThreads, threadFactory, 0);
88 }
89
90 public EpollEventLoopGroup(int nThreads, Executor executor) {
91 this(nThreads, executor, DefaultSelectStrategyFactory.INSTANCE);
92 }
93
94
95
96
97 @SuppressWarnings("deprecation")
98 public EpollEventLoopGroup(int nThreads, ThreadFactory threadFactory, SelectStrategyFactory selectStrategyFactory) {
99 this(nThreads, threadFactory, 0, selectStrategyFactory);
100 }
101
102
103
104
105
106
107
108 @Deprecated
109 public EpollEventLoopGroup(int nThreads, ThreadFactory threadFactory, int maxEventsAtOnce) {
110 this(nThreads, threadFactory, maxEventsAtOnce, DefaultSelectStrategyFactory.INSTANCE);
111 }
112
113
114
115
116
117
118
119
120 @Deprecated
121 public EpollEventLoopGroup(int nThreads, ThreadFactory threadFactory, int maxEventsAtOnce,
122 SelectStrategyFactory selectStrategyFactory) {
123 super(nThreads, threadFactory, EpollIoHandler.newFactory(maxEventsAtOnce, selectStrategyFactory),
124 RejectedExecutionHandlers.reject());
125 }
126
127 public EpollEventLoopGroup(int nThreads, Executor executor, SelectStrategyFactory selectStrategyFactory) {
128 super(nThreads, executor, EpollIoHandler.newFactory(0, selectStrategyFactory),
129 RejectedExecutionHandlers.reject());
130 }
131
132 public EpollEventLoopGroup(int nThreads, Executor executor, EventExecutorChooserFactory chooserFactory,
133 SelectStrategyFactory selectStrategyFactory) {
134 super(nThreads, executor, EpollIoHandler.newFactory(0, selectStrategyFactory), chooserFactory,
135 RejectedExecutionHandlers.reject());
136 }
137
138 public EpollEventLoopGroup(int nThreads, Executor executor, EventExecutorChooserFactory chooserFactory,
139 SelectStrategyFactory selectStrategyFactory,
140 RejectedExecutionHandler rejectedExecutionHandler) {
141 super(nThreads, executor, EpollIoHandler.newFactory(0, selectStrategyFactory), chooserFactory,
142 rejectedExecutionHandler);
143 }
144
145 public EpollEventLoopGroup(int nThreads, Executor executor, EventExecutorChooserFactory chooserFactory,
146 SelectStrategyFactory selectStrategyFactory,
147 RejectedExecutionHandler rejectedExecutionHandler,
148 EventLoopTaskQueueFactory queueFactory) {
149 super(nThreads, executor, EpollIoHandler.newFactory(0, selectStrategyFactory), chooserFactory,
150 rejectedExecutionHandler, queueFactory);
151 }
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166 public EpollEventLoopGroup(int nThreads, Executor executor, EventExecutorChooserFactory chooserFactory,
167 SelectStrategyFactory selectStrategyFactory,
168 RejectedExecutionHandler rejectedExecutionHandler,
169 EventLoopTaskQueueFactory taskQueueFactory,
170 EventLoopTaskQueueFactory tailTaskQueueFactory) {
171 super(nThreads, executor, EpollIoHandler.newFactory(0, selectStrategyFactory),
172 chooserFactory, rejectedExecutionHandler, taskQueueFactory, tailTaskQueueFactory);
173 }
174
175
176
177
178
179
180 @Deprecated
181 public void setIoRatio(int ioRatio) {
182 LOGGER.debug("EpollEventLoopGroup.setIoRatio(int) logic was removed, this is a no-op");
183 }
184
185 @Override
186 protected IoEventLoop newChild(Executor executor, IoHandler handler, Object... args) {
187 RejectedExecutionHandler rejectedExecutionHandler = (RejectedExecutionHandler) args[0];
188 EventLoopTaskQueueFactory taskQueueFactory = null;
189 EventLoopTaskQueueFactory tailTaskQueueFactory = null;
190
191 int argsLength = args.length;
192 if (argsLength > 1) {
193 taskQueueFactory = (EventLoopTaskQueueFactory) args[1];
194 }
195 if (argsLength > 2) {
196 tailTaskQueueFactory = (EventLoopTaskQueueFactory) args[2];
197 }
198 return new EpollEventLoop(this, executor, handler, taskQueueFactory, tailTaskQueueFactory,
199 rejectedExecutionHandler);
200 }
201 }