Package org.jboss.netty.channel
Class AbstractServerChannel
java.lang.Object
org.jboss.netty.channel.AbstractChannel
org.jboss.netty.channel.AbstractServerChannel
- All Implemented Interfaces:
Comparable<Channel>
,Channel
,ServerChannel
- Direct Known Subclasses:
DefaultLocalServerChannel
,NioServerSocketChannel
,OioServerSocketChannel
A skeletal server-side
Channel
implementation. A server-side
Channel
does not allow the following operations:
connect(SocketAddress)
disconnect()
getInterestOps()
setInterestOps(int)
write(Object)
write(Object, SocketAddress)
- and the shortcut methods which calls the methods mentioned above
-
Field Summary
Fields inherited from class org.jboss.netty.channel.AbstractChannel
allChannels
Fields inherited from interface org.jboss.netty.channel.Channel
OP_NONE, OP_READ, OP_READ_WRITE, OP_WRITE
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
AbstractServerChannel
(ChannelFactory factory, ChannelPipeline pipeline, ChannelSink sink) Creates a new instance. -
Method Summary
Modifier and TypeMethodDescriptionconnect
(SocketAddress remoteAddress) Connects this channel to the specified remote address asynchronously.Disconnects this channel from the current remote address asynchronously.int
Returns the currentinterestOps
of this channel.boolean
Returnstrue
if and only if this channel is connected to a remote address.setInterestOps
(int interestOps) Changes theinterestOps
of this channel asynchronously.protected void
setInternalInterestOps
(int interestOps) Sets theinterestOps
property of this channel immediately.Sends a message to this channel asynchronously.write
(Object message, SocketAddress remoteAddress) Sends a message to this channel asynchronously.Methods inherited from class org.jboss.netty.channel.AbstractChannel
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
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.jboss.netty.channel.Channel
bind, close, getAttachment, getCloseFuture, getConfig, getFactory, getId, getLocalAddress, getParent, getPipeline, getRemoteAddress, getUserDefinedWritability, isBound, isOpen, isReadable, isWritable, setAttachment, setReadable, setUserDefinedWritability, unbind
Methods inherited from interface java.lang.Comparable
compareTo
-
Constructor Details
-
AbstractServerChannel
Creates a new instance.- Parameters:
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 pipeline
-
-
Method Details
-
connect
Description copied from interface:Channel
Connects this channel to the specified remote address asynchronously.- Specified by:
connect
in interfaceChannel
- Overrides:
connect
in classAbstractChannel
- Parameters:
remoteAddress
- where to connect- Returns:
- the
ChannelFuture
which will be notified when the connection request succeeds or fails
-
disconnect
Description copied from interface:Channel
Disconnects this channel from the current remote address asynchronously.- Specified by:
disconnect
in interfaceChannel
- Overrides:
disconnect
in classAbstractChannel
- Returns:
- the
ChannelFuture
which will be notified when the disconnection request succeeds or fails
-
getInterestOps
public int getInterestOps()Description copied from interface:Channel
Returns the currentinterestOps
of this channel.- Specified by:
getInterestOps
in interfaceChannel
- Overrides:
getInterestOps
in classAbstractChannel
- Returns:
Channel.OP_NONE
,Channel.OP_READ
,Channel.OP_WRITE
, orChannel.OP_READ_WRITE
-
setInterestOps
Description copied from interface:Channel
Changes theinterestOps
of this channel asynchronously.- Specified by:
setInterestOps
in interfaceChannel
- Overrides:
setInterestOps
in classAbstractChannel
- Parameters:
interestOps
- the newinterestOps
- Returns:
- the
ChannelFuture
which will be notified when theinterestOps
change request succeeds or fails
-
setInternalInterestOps
protected void setInternalInterestOps(int interestOps) Description copied from class:AbstractChannel
Sets theinterestOps
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.- Overrides:
setInternalInterestOps
in classAbstractChannel
-
write
Description copied from interface:Channel
Sends a message to this channel asynchronously. If this channel was created by a connectionless transport (e.g.DatagramChannel
) and is not connected yet, you have to callChannel.write(Object, SocketAddress)
instead. Otherwise, the write request will fail withNotYetConnectedException
and an'exceptionCaught'
event will be triggered.- Specified by:
write
in interfaceChannel
- Overrides:
write
in classAbstractChannel
- Parameters:
message
- the message to write- Returns:
- the
ChannelFuture
which will be notified when the write request succeeds or fails
-
write
Description copied from interface:Channel
Sends a message to this channel asynchronously. It has an additional parameter that allows a user to specify where to send the specified message instead of this channel's current remote address. If this channel was created by a connectionless transport (e.g.DatagramChannel
) and is not connected yet, you must specify non-null address. Otherwise, the write request will fail withNotYetConnectedException
and an'exceptionCaught'
event will be triggered.- Specified by:
write
in interfaceChannel
- Overrides:
write
in classAbstractChannel
- Parameters:
message
- the message to writeremoteAddress
- where to send the specified message. This method is identical toChannel.write(Object)
ifnull
is specified here.- Returns:
- the
ChannelFuture
which will be notified when the write request succeeds or fails
-
isConnected
public boolean isConnected()Description copied from interface:Channel
Returnstrue
if and only if this channel is connected to a remote address.- Specified by:
isConnected
in interfaceChannel
-