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
Modifier | Constructor and Description |
---|---|
protected |
AbstractServerChannel(ChannelFactory factory,
ChannelPipeline pipeline,
ChannelSink sink)
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
ChannelFuture |
connect(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 |
setInterestOpsNow(int interestOps)
Sets the
interestOps property of this channel
immediately. |
ChannelFuture |
write(Object message)
Sends a message to this channel asynchronously.
|
ChannelFuture |
write(Object message,
SocketAddress remoteAddress)
Sends a message to this channel asynchronously.
|
bind, close, compareTo, equals, getAttachment, getCloseFuture, getFactory, getId, getParent, getPipeline, getSucceededFuture, getUnsupportedOperationFuture, hashCode, isOpen, isReadable, isWritable, setAttachment, setClosed, setReadable, toString, unbind
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
bind, close, getAttachment, getCloseFuture, getConfig, getFactory, getId, getLocalAddress, getParent, getPipeline, getRemoteAddress, isBound, isOpen, isReadable, isWritable, setAttachment, setReadable, unbind
compareTo
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(SocketAddress remoteAddress)
Channel
connect
in interface Channel
connect
in class AbstractChannel
remoteAddress
- where to connectChannelFuture
which will be notified when the
connection request succeeds or failspublic ChannelFuture disconnect()
Channel
disconnect
in interface Channel
disconnect
in class AbstractChannel
ChannelFuture
which will be notified when the
disconnection request succeeds or failspublic int getInterestOps()
Channel
interestOps
of this channel.getInterestOps
in interface Channel
getInterestOps
in class 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
in interface Channel
setInterestOps
in class AbstractChannel
interestOps
- the new interestOps
ChannelFuture
which will be notified when the
interestOps
change request succeeds or failsprotected void setInterestOpsNow(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.setInterestOpsNow
in class AbstractChannel
public ChannelFuture write(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
in interface Channel
write
in class AbstractChannel
message
- the message to writeChannelFuture
which will be notified when the
write request succeeds or failspublic ChannelFuture write(Object message, 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
in interface Channel
write
in class 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
in interface Channel
Copyright © 2008-2014 The Netty Project. All Rights Reserved.