Added ChannelPipeline.isAttached()

This commit is contained in:
Trustin Lee 2008-12-03 07:14:22 +00:00
parent e5c42ba3f1
commit f6b23a000b
2 changed files with 10 additions and 0 deletions

View File

@ -415,6 +415,12 @@ public interface ChannelPipeline {
*/
void attach(Channel channel, ChannelSink sink);
/**
* Returns {@code true} if and only if this pipeline is attached to
* a {@link Channel}.
*/
boolean isAttached();
/**
* Converts this pipeline into an ordered {@link Map} whose keys are
* handler names and whose values are handlers.

View File

@ -99,6 +99,10 @@ public class DefaultChannelPipeline implements ChannelPipeline {
this.sink = sink;
}
public boolean isAttached() {
return channel != null && sink != null;
}
public synchronized void addFirst(String name, ChannelHandler handler) {
if (name2ctx.isEmpty()) {
init(name, handler);