1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.jboss.netty.channel;
17
18 import java.util.concurrent.TimeUnit;
19
20 import org.jboss.netty.logging.InternalLogger;
21 import org.jboss.netty.logging.InternalLoggerFactory;
22
23
24
25
26
27
28
29
30
31
32 public abstract class CompleteChannelFuture implements ChannelFuture {
33
34 private static final InternalLogger logger =
35 InternalLoggerFactory.getInstance(CompleteChannelFuture.class);
36
37 private final Channel channel;
38
39
40
41
42
43
44 protected CompleteChannelFuture(Channel channel) {
45 if (channel == null) {
46 throw new NullPointerException("channel");
47 }
48 this.channel = channel;
49 }
50
51 public void addListener(ChannelFutureListener listener) {
52 try {
53 listener.operationComplete(this);
54 } catch (Throwable t) {
55 logger.warn(
56 "An exception was thrown by " +
57 ChannelFutureListener.class.getSimpleName() + ".", t);
58 }
59 }
60
61 public void removeListener(ChannelFutureListener listener) {
62
63 }
64
65 public ChannelFuture await() throws InterruptedException {
66 if (Thread.interrupted()) {
67 throw new InterruptedException();
68 }
69 return this;
70 }
71
72 public boolean await(long timeout, TimeUnit unit) throws InterruptedException {
73 if (Thread.interrupted()) {
74 throw new InterruptedException();
75 }
76 return true;
77 }
78
79 public boolean await(long timeoutMillis) throws InterruptedException {
80 if (Thread.interrupted()) {
81 throw new InterruptedException();
82 }
83 return true;
84 }
85
86 public ChannelFuture awaitUninterruptibly() {
87 return this;
88 }
89
90 public boolean awaitUninterruptibly(long timeout, TimeUnit unit) {
91 return true;
92 }
93
94 public boolean awaitUninterruptibly(long timeoutMillis) {
95 return true;
96 }
97
98 public Channel getChannel() {
99 return channel;
100 }
101
102 public boolean isDone() {
103 return true;
104 }
105
106 public boolean setProgress(long amount, long current, long total) {
107 return false;
108 }
109
110 public boolean setFailure(Throwable cause) {
111 return false;
112 }
113
114 public boolean setSuccess() {
115 return false;
116 }
117
118 public boolean cancel() {
119 return false;
120 }
121
122 public boolean isCancelled() {
123 return false;
124 }
125 }