1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.jboss.netty.channel;
17
18 import static org.jboss.netty.channel.Channels.*;
19
20
21
22
23
24
25
26
27
28
29 public class DefaultChildChannelStateEvent implements ChildChannelStateEvent {
30
31 private final Channel parentChannel;
32 private final Channel childChannel;
33
34
35
36
37 public DefaultChildChannelStateEvent(Channel parentChannel, Channel childChannel) {
38 if (parentChannel == null) {
39 throw new NullPointerException("parentChannel");
40 }
41 if (childChannel == null) {
42 throw new NullPointerException("childChannel");
43 }
44 this.parentChannel = parentChannel;
45 this.childChannel = childChannel;
46 }
47
48 public Channel getChannel() {
49 return parentChannel;
50 }
51
52 public ChannelFuture getFuture() {
53 return succeededFuture(getChannel());
54 }
55
56 public Channel getChildChannel() {
57 return childChannel;
58 }
59
60 @Override
61 public String toString() {
62 String channelString = getChannel().toString();
63 StringBuilder buf = new StringBuilder(channelString.length() + 32);
64 buf.append(channelString);
65 buf.append(getChildChannel().isOpen()? " CHILD_OPEN: " : " CHILD_CLOSED: ");
66 buf.append(getChildChannel().getId());
67 return buf.toString();
68 }
69 }