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 AbstractChannel
allChannelsFields inherited from interface Channel
OP_NONE, OP_READ, OP_READ_WRITE, OP_WRITE -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractServerChannel(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.intReturns the currentinterestOpsof this channel.booleanReturnstrueif and only if this channel is connected to a remote address.setInterestOps(int interestOps) Changes theinterestOpsof this channel asynchronously.protected voidsetInternalInterestOps(int interestOps) Sets theinterestOpsproperty 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 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, unbindMethods inherited from interface Channel
bind, close, getAttachment, getCloseFuture, getConfig, getFactory, getId, getLocalAddress, getParent, getPipeline, getRemoteAddress, getUserDefinedWritability, isBound, isOpen, isReadable, isWritable, setAttachment, setReadable, setUserDefinedWritability, unbindMethods inherited from interface 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:ChannelConnects this channel to the specified remote address asynchronously.- Specified by:
connectin interfaceChannel- Overrides:
connectin classAbstractChannel- Parameters:
remoteAddress- where to connect- Returns:
- the
ChannelFuturewhich will be notified when the connection request succeeds or fails
-
disconnect
Description copied from interface:ChannelDisconnects this channel from the current remote address asynchronously.- Specified by:
disconnectin interfaceChannel- Overrides:
disconnectin classAbstractChannel- Returns:
- the
ChannelFuturewhich will be notified when the disconnection request succeeds or fails
-
getInterestOps
public int getInterestOps()Description copied from interface:ChannelReturns the currentinterestOpsof this channel.- Specified by:
getInterestOpsin interfaceChannel- Overrides:
getInterestOpsin classAbstractChannel- Returns:
Channel.OP_NONE,Channel.OP_READ,Channel.OP_WRITE, orChannel.OP_READ_WRITE
-
setInterestOps
Description copied from interface:ChannelChanges theinterestOpsof this channel asynchronously.- Specified by:
setInterestOpsin interfaceChannel- Overrides:
setInterestOpsin classAbstractChannel- Parameters:
interestOps- the newinterestOps- Returns:
- the
ChannelFuturewhich will be notified when theinterestOpschange request succeeds or fails
-
setInternalInterestOps
protected void setInternalInterestOps(int interestOps) Description copied from class:AbstractChannelSets theinterestOpsproperty 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:
setInternalInterestOpsin classAbstractChannel
-
write
Description copied from interface:ChannelSends 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 withNotYetConnectedExceptionand an'exceptionCaught'event will be triggered.- Specified by:
writein interfaceChannel- Overrides:
writein classAbstractChannel- Parameters:
message- the message to write- Returns:
- the
ChannelFuturewhich will be notified when the write request succeeds or fails
-
write
Description copied from interface:ChannelSends 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 withNotYetConnectedExceptionand an'exceptionCaught'event will be triggered.- Specified by:
writein interfaceChannel- Overrides:
writein classAbstractChannel- Parameters:
message- the message to writeremoteAddress- where to send the specified message. This method is identical toChannel.write(Object)ifnullis specified here.- Returns:
- the
ChannelFuturewhich will be notified when the write request succeeds or fails
-
isConnected
public boolean isConnected()Description copied from interface:ChannelReturnstrueif and only if this channel is connected to a remote address.- Specified by:
isConnectedin interfaceChannel
-