1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package io.netty.util.concurrent;
18
19 import io.netty.util.internal.ObjectUtil;
20
21 import java.util.concurrent.TimeUnit;
22
23
24
25
26 public abstract class CompleteFuture<V> extends AbstractFuture<V> {
27
28 private final EventExecutor executor;
29
30
31
32
33
34
35 protected CompleteFuture(EventExecutor executor) {
36 this.executor = executor;
37 }
38
39
40
41
42 protected EventExecutor executor() {
43 return executor;
44 }
45
46 @Override
47 public Future<V> addListener(GenericFutureListener<? extends Future<? super V>> listener) {
48 DefaultPromise.notifyListener(executor(), this, ObjectUtil.checkNotNull(listener, "listener"));
49 return this;
50 }
51
52 @Override
53 public Future<V> addListeners(GenericFutureListener<? extends Future<? super V>>... listeners) {
54 for (GenericFutureListener<? extends Future<? super V>> l:
55 ObjectUtil.checkNotNull(listeners, "listeners")) {
56
57 if (l == null) {
58 break;
59 }
60 DefaultPromise.notifyListener(executor(), this, l);
61 }
62 return this;
63 }
64
65 @Override
66 public Future<V> removeListener(GenericFutureListener<? extends Future<? super V>> listener) {
67
68 return this;
69 }
70
71 @Override
72 public Future<V> removeListeners(GenericFutureListener<? extends Future<? super V>>... listeners) {
73
74 return this;
75 }
76
77 @Override
78 public Future<V> await() throws InterruptedException {
79 if (Thread.interrupted()) {
80 throw new InterruptedException();
81 }
82 return this;
83 }
84
85 @Override
86 public boolean await(long timeout, TimeUnit unit) throws InterruptedException {
87 if (Thread.interrupted()) {
88 throw new InterruptedException();
89 }
90 return true;
91 }
92
93 @Override
94 public Future<V> sync() throws InterruptedException {
95 return this;
96 }
97
98 @Override
99 public Future<V> syncUninterruptibly() {
100 return this;
101 }
102
103 @Override
104 public boolean await(long timeoutMillis) throws InterruptedException {
105 if (Thread.interrupted()) {
106 throw new InterruptedException();
107 }
108 return true;
109 }
110
111 @Override
112 public Future<V> awaitUninterruptibly() {
113 return this;
114 }
115
116 @Override
117 public boolean awaitUninterruptibly(long timeout, TimeUnit unit) {
118 return true;
119 }
120
121 @Override
122 public boolean awaitUninterruptibly(long timeoutMillis) {
123 return true;
124 }
125
126 @Override
127 public boolean isDone() {
128 return true;
129 }
130
131 @Override
132 public boolean isCancellable() {
133 return false;
134 }
135
136 @Override
137 public boolean isCancelled() {
138 return false;
139 }
140
141
142
143
144
145
146 @Override
147 public boolean cancel(boolean mayInterruptIfRunning) {
148 return false;
149 }
150 }