1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package io.netty.channel;
17
18 import io.netty.util.concurrent.DefaultThreadFactory;
19
20 import java.util.concurrent.Executor;
21 import java.util.concurrent.ThreadFactory;
22
23 public class DefaultEventLoop extends SingleThreadEventLoop {
24
25 public DefaultEventLoop() {
26 this((EventLoopGroup) null);
27 }
28
29 public DefaultEventLoop(ThreadFactory threadFactory) {
30 this(null, threadFactory);
31 }
32
33 public DefaultEventLoop(Executor executor) {
34 this(null, executor);
35 }
36
37 public DefaultEventLoop(EventLoopGroup parent) {
38 this(parent, new DefaultThreadFactory(DefaultEventLoop.class));
39 }
40
41 public DefaultEventLoop(EventLoopGroup parent, ThreadFactory threadFactory) {
42 super(parent, threadFactory, true);
43 }
44
45 public DefaultEventLoop(EventLoopGroup parent, Executor executor) {
46 super(parent, executor, true);
47 }
48
49 @Override
50 protected void run() {
51 for (;;) {
52 Runnable task = takeTask();
53 if (task != null) {
54 runTask(task);
55 updateLastExecutionTime();
56 }
57
58 if (confirmShutdown()) {
59 break;
60 }
61 }
62 }
63 }