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