org.jboss.netty.channel
Class AbstractServerChannel

java.lang.Object
  extended by org.jboss.netty.channel.AbstractChannel
      extended by org.jboss.netty.channel.AbstractServerChannel
All Implemented Interfaces:
Comparable<Channel>, Channel, ServerChannel

public abstract class AbstractServerChannel
extends AbstractChannel
implements ServerChannel

A skeletal server-side Channel implementation. A server-side Channel does not allow the following operations:

Version:
$Rev: 2080 $, $Date: 2010-01-26 18:04:19 +0900 (Tue, 26 Jan 2010) $
Author:
The Netty Project, Trustin Lee

Field Summary
 
Fields inherited from interface org.jboss.netty.channel.Channel
OP_NONE, OP_READ, OP_READ_WRITE, OP_WRITE
 
Constructor Summary
protected AbstractServerChannel(ChannelFactory factory, ChannelPipeline pipeline, ChannelSink sink)
          Creates a new instance.
 
Method Summary
 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.
 
Methods inherited from class org.jboss.netty.channel.AbstractChannel
bind, close, compareTo, equals, getCloseFuture, getFactory, getId, getParent, getPipeline, getSucceededFuture, getUnsupportedOperationFuture, hashCode, isOpen, isReadable, isWritable, setClosed, setReadable, 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, getCloseFuture, getConfig, getFactory, getId, getLocalAddress, getParent, getPipeline, getRemoteAddress, isBound, isOpen, isReadable, isWritable, setReadable, unbind
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Constructor Detail

AbstractServerChannel

protected AbstractServerChannel(ChannelFactory factory,
                                ChannelPipeline pipeline,
                                ChannelSink sink)
Creates a new instance.

Parameters:
factory - the factory which created this channel
pipeline - the pipeline which is going to be attached to this channel
sink - the sink which will receive downstream events from the pipeline and send upstream events to the pipeline
Method Detail

connect

public ChannelFuture connect(SocketAddress remoteAddress)
Description copied from interface: Channel
Connects this channel to the specified remote address asynchronously.

Specified by:
connect in interface Channel
Overrides:
connect in class AbstractChannel
Parameters:
remoteAddress - where to connect
Returns:
the ChannelFuture which will be notified when the connection request succeeds or fails

disconnect

public ChannelFuture disconnect()
Description copied from interface: Channel
Disconnects this channel from the current remote address asynchronously.

Specified by:
disconnect in interface Channel
Overrides:
disconnect in class AbstractChannel
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 current interestOps of this channel.

Specified by:
getInterestOps in interface Channel
Overrides:
getInterestOps in class AbstractChannel
Returns:
Channel.OP_NONE, Channel.OP_READ, Channel.OP_WRITE, or Channel.OP_READ_WRITE

setInterestOps

public ChannelFuture setInterestOps(int interestOps)
Description copied from interface: Channel
Changes the interestOps of this channel asynchronously.

Specified by:
setInterestOps in interface Channel
Overrides:
setInterestOps in class AbstractChannel
Parameters:
interestOps - the new interestOps
Returns:
the ChannelFuture which will be notified when the interestOps change request succeeds or fails

setInterestOpsNow

protected void setInterestOpsNow(int interestOps)
Description copied from class: AbstractChannel
Sets the 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.

Overrides:
setInterestOpsNow in class AbstractChannel

write

public ChannelFuture write(Object message)
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 call Channel.write(Object, SocketAddress) instead. Otherwise, the write request will fail with NotYetConnectedException and an 'exceptionCaught' event will be triggered.

Specified by:
write in interface Channel
Overrides:
write in class AbstractChannel
Parameters:
message - the message to write
Returns:
the ChannelFuture which will be notified when the write request succeeds or fails

write

public ChannelFuture write(Object message,
                           SocketAddress remoteAddress)
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 with NotYetConnectedException and an 'exceptionCaught' event will be triggered.

Specified by:
write in interface Channel
Overrides:
write in class AbstractChannel
Parameters:
message - the message to write
remoteAddress - where to send the specified message. This method is identical to Channel.write(Object) if null 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
Returns true if and only if this channel is connected to a remote address.

Specified by:
isConnected in interface Channel


Copyright © 2008-2011 JBoss, a division of Red Hat, Inc.. All Rights Reserved.