public abstract class AbstractServerChannel extends AbstractChannel implements ServerChannel
Channel
implementation. A server-side
Channel
does not allow the following operations:
connect(SocketAddress)
disconnect()
getInterestOps()
setInterestOps(int)
write(Object)
write(Object, SocketAddress)
OP_NONE, OP_READ, OP_READ_WRITE, OP_WRITE
限定符 | 构造器和说明 |
---|---|
protected |
AbstractServerChannel(ChannelFactory factory,
ChannelPipeline pipeline,
ChannelSink sink)
Creates a new instance.
|
限定符和类型 | 方法和说明 |
---|---|
ChannelFuture |
connect(java.net.SocketAddress remoteAddress)
Connects this channel to the specified remote address asynchronously.
|
ChannelFuture |
disconnect()
Disconnects this channel from the current remote address asynchronously.
|
int |
getInterestOps()
Returns the current
interestOps of this channel. |
boolean |
isConnected()
Returns
true if and only if this channel is connected to a
remote address. |
ChannelFuture |
setInterestOps(int interestOps)
Changes the
interestOps of this channel asynchronously. |
protected void |
setInternalInterestOps(int interestOps)
Sets the
interestOps property of this channel
immediately. |
ChannelFuture |
write(java.lang.Object message)
Sends a message to this channel asynchronously.
|
ChannelFuture |
write(java.lang.Object message,
java.net.SocketAddress remoteAddress)
Sends a message to this channel asynchronously.
|
bind, close, compareTo, equals, getAttachment, getCloseFuture, getFactory, getId, getInternalInterestOps, getParent, getPipeline, getSucceededFuture, getUnsupportedOperationFuture, getUserDefinedWritability, hashCode, isOpen, isReadable, isWritable, setAttachment, setClosed, setReadable, setUnwritable, setUserDefinedWritability, setWritable, toString, unbind
bind, close, getAttachment, getCloseFuture, getConfig, getFactory, getId, getLocalAddress, getParent, getPipeline, getRemoteAddress, getUserDefinedWritability, isBound, isOpen, isReadable, isWritable, setAttachment, setReadable, setUserDefinedWritability, unbind
protected AbstractServerChannel(ChannelFactory factory, ChannelPipeline pipeline, ChannelSink sink)
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 ChannelFuture connect(java.net.SocketAddress remoteAddress)
Channel
connect
在接口中 Channel
connect
在类中 AbstractChannel
remoteAddress
- where to connectChannelFuture
which will be notified when the
connection request succeeds or failspublic ChannelFuture disconnect()
Channel
disconnect
在接口中 Channel
disconnect
在类中 AbstractChannel
ChannelFuture
which will be notified when the
disconnection request succeeds or failspublic int getInterestOps()
Channel
interestOps
of this channel.getInterestOps
在接口中 Channel
getInterestOps
在类中 AbstractChannel
Channel.OP_NONE
, Channel.OP_READ
, Channel.OP_WRITE
, or
Channel.OP_READ_WRITE
public ChannelFuture setInterestOps(int interestOps)
Channel
interestOps
of this channel asynchronously.setInterestOps
在接口中 Channel
setInterestOps
在类中 AbstractChannel
interestOps
- the new interestOps
ChannelFuture
which will be notified when the
interestOps
change request succeeds or failsprotected void setInternalInterestOps(int interestOps)
AbstractChannel
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 ChannelFuture write(java.lang.Object message)
Channel
DatagramChannel
)
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
在接口中 Channel
write
在类中 AbstractChannel
message
- the message to writeChannelFuture
which will be notified when the
write request succeeds or failspublic ChannelFuture write(java.lang.Object message, java.net.SocketAddress remoteAddress)
Channel
DatagramChannel
)
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
在接口中 Channel
write
在类中 AbstractChannel
message
- 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 boolean isConnected()
Channel
true
if and only if this channel is connected to a
remote address.isConnected
在接口中 Channel