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