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.Channel;
19 import io.netty.channel.EventLoopTaskQueueFactory;
20 import io.netty.channel.IoEventLoopGroup;
21 import io.netty.channel.IoHandler;
22 import io.netty.channel.SingleThreadIoEventLoop;
23 import io.netty.util.concurrent.RejectedExecutionHandler;
24 import io.netty.util.internal.PlatformDependent;
25 import io.netty.util.internal.logging.InternalLogger;
26 import io.netty.util.internal.logging.InternalLoggerFactory;
27
28 import java.util.Iterator;
29 import java.util.Queue;
30 import java.util.concurrent.Executor;
31 import java.util.concurrent.ThreadFactory;
32
33
34
35
36 @Deprecated
37 public class EpollEventLoop extends SingleThreadIoEventLoop {
38
39 private static final InternalLogger LOGGER = InternalLoggerFactory.getInstance(EpollEventLoop.class);
40
41 EpollEventLoop(IoEventLoopGroup parent, ThreadFactory threadFactory, IoHandler ioHandler) {
42 super(parent, threadFactory, ioHandler);
43 }
44
45 EpollEventLoop(IoEventLoopGroup parent, Executor executor, IoHandler ioHandler) {
46 super(parent, executor, ioHandler);
47 }
48
49 EpollEventLoop(IoEventLoopGroup parent, Executor executor, IoHandler ioHandler,
50 EventLoopTaskQueueFactory taskQueueFactory,
51 EventLoopTaskQueueFactory tailTaskQueueFactory,
52 RejectedExecutionHandler rejectedExecutionHandler) {
53 super(parent, executor, ioHandler, newTaskQueue(taskQueueFactory), newTaskQueue(tailTaskQueueFactory),
54 rejectedExecutionHandler);
55 }
56
57 private static Queue<Runnable> newTaskQueue(
58 EventLoopTaskQueueFactory queueFactory) {
59 if (queueFactory == null) {
60 return newTaskQueue0(DEFAULT_MAX_PENDING_TASKS);
61 }
62 return queueFactory.newTaskQueue(DEFAULT_MAX_PENDING_TASKS);
63 }
64
65 @Override
66 protected Queue<Runnable> newTaskQueue(int maxPendingTasks) {
67 return newTaskQueue0(maxPendingTasks);
68 }
69
70 private static Queue<Runnable> newTaskQueue0(int maxPendingTasks) {
71
72 return maxPendingTasks == Integer.MAX_VALUE ? PlatformDependent.<Runnable>newMpscQueue()
73 : PlatformDependent.<Runnable>newMpscQueue(maxPendingTasks);
74 }
75
76 @Override
77 public int registeredChannels() {
78 return ((EpollIoHandler) ioHandler()).numRegisteredChannels();
79 }
80
81 @Override
82 public Iterator<Channel> registeredChannelsIterator() {
83 return ((EpollIoHandler) ioHandler()).registeredChannelsList().iterator();
84 }
85
86
87
88
89 public int getIoRatio() {
90 return 0;
91 }
92
93
94
95
96
97
98 @Deprecated
99 public void setIoRatio(int ioRatio) {
100 LOGGER.debug("EpollEventLoop.setIoRatio(int) logic was removed, this is a no-op");
101 }
102 }