
public abstract class AbstractChannel extends Object implements Channel
Channel implementation.OP_NONE, OP_READ, OP_READ_WRITE, OP_WRITE| Modifier | Constructor and Description | 
|---|---|
| protected  | AbstractChannel(Channel parent,
               ChannelFactory factory,
               ChannelPipeline pipeline,
               ChannelSink sink)Creates a new instance. | 
| protected  | AbstractChannel(Integer id,
               Channel parent,
               ChannelFactory factory,
               ChannelPipeline pipeline,
               ChannelSink sink)(Internal use only) Creates a new temporary instance with the specified
 ID. | 
| Modifier and Type | Method and Description | 
|---|---|
| ChannelFuture | bind(SocketAddress localAddress)Binds this channel to the specified local address asynchronously. | 
| ChannelFuture | close()Closes this channel asynchronously. | 
| int | compareTo(Channel o)Compares the ID of the two channels. | 
| ChannelFuture | connect(SocketAddress remoteAddress)Connects this channel to the specified remote address asynchronously. | 
| ChannelFuture | disconnect()Disconnects this channel from the current remote address asynchronously. | 
| boolean | equals(Object o)Returns  trueif and only if the specified object is identical
 with this channel (i.e:this == o). | 
| Object | getAttachment() | 
| ChannelFuture | getCloseFuture()Returns the  ChannelFuturewhich will be notified when this
 channel is closed. | 
| ChannelFactory | getFactory()Returns the  ChannelFactorywhich created this channel. | 
| Integer | getId()Returns the unique integer ID of this channel. | 
| int | getInterestOps()Returns the current  interestOpsof this channel. | 
| Channel | getParent()Returns the parent of this channel. | 
| ChannelPipeline | getPipeline()Returns the  ChannelPipelinewhich handlesChannelEvents
 associated with this channel. | 
| protected ChannelFuture | getSucceededFuture()Returns the cached  SucceededChannelFutureinstance. | 
| protected ChannelFuture | getUnsupportedOperationFuture()Returns the  FailedChannelFuturewhose cause is anUnsupportedOperationException. | 
| int | hashCode()Returns the ID of this channel. | 
| boolean | isOpen()Returns  trueif and only if this channel is open. | 
| boolean | isReadable()Returns  trueif and only if the I/O thread will read a message
 from this channel. | 
| boolean | isWritable()Returns  trueif and only if the I/O thread will perform the
 requested write operation immediately. | 
| void | setAttachment(Object attachment)Attaches an object to this  Channelto store a stateful
 information | 
| protected boolean | setClosed()Marks this channel as closed. | 
| ChannelFuture | setInterestOps(int interestOps)Changes the  interestOpsof this channel asynchronously. | 
| protected void | setInterestOpsNow(int interestOps)Sets the  interestOpsproperty of this channel
 immediately. | 
| ChannelFuture | setReadable(boolean readable)Suspends or resumes the read operation of the I/O thread asynchronously. | 
| String | toString()Returns the  Stringrepresentation of this channel. | 
| ChannelFuture | unbind()Unbinds this channel from the current local address asynchronously. | 
| ChannelFuture | write(Object message)Sends a message to this channel asynchronously. | 
| ChannelFuture | write(Object message,
     SocketAddress remoteAddress)Sends a message to this channel asynchronously. | 
clone, finalize, getClass, notify, notifyAll, wait, wait, waitgetConfig, getLocalAddress, getRemoteAddress, isBound, isConnectedprotected AbstractChannel(Channel parent, ChannelFactory factory, ChannelPipeline pipeline, ChannelSink sink)
parent - the parent of this channel. null if there's no parent.factory - the factory which created this channelpipeline - the pipeline which is going to be attached to this channelsink - the sink which will receive downstream events from the pipeline
        and send upstream events to the pipelineprotected AbstractChannel(Integer id, Channel parent, ChannelFactory factory, ChannelPipeline pipeline, ChannelSink sink)
parent - the parent of this channel. null if there's no parent.factory - the factory which created this channelpipeline - the pipeline which is going to be attached to this channelsink - the sink which will receive downstream events from the pipeline
        and send upstream events to the pipelinepublic final Integer getId()
Channelpublic Channel getParent()
Channelpublic ChannelFactory getFactory()
ChannelChannelFactory which created this channel.getFactory in interface Channelpublic ChannelPipeline getPipeline()
ChannelChannelPipeline which handles ChannelEvents
 associated with this channel.getPipeline in interface Channelprotected ChannelFuture getSucceededFuture()
SucceededChannelFuture instance.protected ChannelFuture getUnsupportedOperationFuture()
FailedChannelFuture whose cause is an
 UnsupportedOperationException.public final int hashCode()
public final boolean equals(Object o)
true if and only if the specified object is identical
 with this channel (i.e: this == o).public final int compareTo(Channel o)
compareTo in interface Comparable<Channel>public boolean isOpen()
Channeltrue if and only if this channel is open.protected boolean setClosed()
true if and only if this channel was not marked as
                      closed yetpublic ChannelFuture bind(SocketAddress localAddress)
Channelbind in interface ChannellocalAddress - where to bindChannelFuture which will be notified when the
         bind request succeeds or failspublic ChannelFuture unbind()
Channelunbind in interface ChannelChannelFuture which will be notified when the
         unbind request succeeds or failspublic ChannelFuture close()
Channelclose in interface ChannelChannelFuture which will be notified when the
         close request succeeds or failspublic ChannelFuture getCloseFuture()
ChannelChannelFuture which will be notified when this
 channel is closed.  This method always returns the same future instance.getCloseFuture in interface Channelpublic ChannelFuture connect(SocketAddress remoteAddress)
Channelconnect in interface ChannelremoteAddress - where to connectChannelFuture which will be notified when the
         connection request succeeds or failspublic ChannelFuture disconnect()
Channeldisconnect in interface ChannelChannelFuture which will be notified when the
         disconnection request succeeds or failspublic int getInterestOps()
ChannelinterestOps of this channel.getInterestOps in interface ChannelChannel.OP_NONE, Channel.OP_READ, Channel.OP_WRITE, or
         Channel.OP_READ_WRITEpublic ChannelFuture setInterestOps(int interestOps)
ChannelinterestOps of this channel asynchronously.setInterestOps in interface ChannelinterestOps - the new interestOpsChannelFuture which will be notified when the
         interestOps change request succeeds or failsprotected void setInterestOpsNow(int interestOps)
interestOps property of this channel
 immediately.  This method is intended to be called by an internal
 component - please do not call it unless you know what you are doing.public boolean isReadable()
Channeltrue if and only if the I/O thread will read a message
 from this channel.  This method is a shortcut to the following code:
 return (getInterestOps() & OP_READ) != 0;
isReadable in interface Channelpublic boolean isWritable()
Channeltrue if and only if the I/O thread will perform the
 requested write operation immediately.  Any write requests made when
 this method returns false are queued until the I/O thread is
 ready to process the queued write requests.  This method is a shortcut
 to the following code:
 return (getInterestOps() & OP_WRITE) == 0;
isWritable in interface Channelpublic ChannelFuture setReadable(boolean readable)
Channel
 int interestOps = getInterestOps();
 if (readable) {
     setInterestOps(interestOps | OP_READ);
 } else {
     setInterestOps(interestOps & ~OP_READ);
 }
 setReadable in interface Channelreadable - true to resume the read operation and
                 false to suspend the read operationChannelFuture which will be notified when the
         interestOps change request succeeds or failspublic ChannelFuture write(Object message)
ChannelDatagramChannel)
 and is not connected yet, you have to call Channel.write(Object, SocketAddress)
 instead.  Otherwise, the write request will fail with
 NotYetConnectedException and an 'exceptionCaught' event
 will be triggered.write in interface Channelmessage - the message to writeChannelFuture which will be notified when the
         write request succeeds or failspublic ChannelFuture write(Object message, SocketAddress remoteAddress)
ChannelDatagramChannel)
 and is not connected yet, you must specify non-null address.  Otherwise,
 the write request will fail with NotYetConnectedException and
 an 'exceptionCaught' event will be triggered.write in interface Channelmessage - the message to writeremoteAddress - where to send the specified message.
                      This method is identical to Channel.write(Object)
                      if null is specified here.ChannelFuture which will be notified when the
         write request succeeds or failspublic Object getAttachment()
ChannelgetAttachment in interface Channelnull if no object was attached or null was
         attachedpublic void setAttachment(Object attachment)
ChannelChannel to store a stateful
 informationsetAttachment in interface Channelpublic String toString()
String representation of this channel.  The returned
 string contains the ID, local address,
 and remote address of this channel for
 easier identification.Copyright © 2008-2013 The Netty Project. All Rights Reserved.