JBoss Remoting 3 3.2.13.GA-redhat-1

org.jboss.remoting3
Interface Channel

All Superinterfaces:
Attachable, Closeable, org.xnio.channels.Configurable, HandleableCloseable<Channel>

public interface Channel
extends Attachable, HandleableCloseable<Channel>, org.xnio.channels.Configurable

The most basic level of communications in a Remoting connection. A channel simply sends and receives messages. No request/reply correlation is performed. Messages are received in the order that they are written; however, multiple messages may flow in or out concurrently on a single channel. In particular, a later message may complete before an earlier message does.

Author:
David M. Lloyd

Nested Class Summary
static interface Channel.Receiver
          A handler for an incoming message.
 
Nested classes/interfaces inherited from interface org.jboss.remoting3.HandleableCloseable
HandleableCloseable.Key
 
Method Summary
 void close()
          Close this channel.
 Connection getConnection()
          Get the connection associated with this channel.
<T> T
getOption(org.xnio.Option<T> option)
          Get the value of a channel option.
 void receiveMessage(Channel.Receiver handler)
          Initiate processing of the next message, when it comes in.
<T> T
setOption(org.xnio.Option<T> option, T value)
          Set an option for this channel.
 boolean supportsOption(org.xnio.Option<?> option)
          Determine whether an option is supported on this channel.
 MessageOutputStream writeMessage()
          Write a new message on to this channel, blocking if necessary.
 void writeShutdown()
          Send an end-of-messages signal to the remote side.
 
Methods inherited from interface org.jboss.remoting3.Attachable
getAttachments
 
Methods inherited from interface org.jboss.remoting3.HandleableCloseable
addCloseHandler, awaitClosed, awaitClosedUninterruptibly, closeAsync
 

Method Detail

getConnection

Connection getConnection()
Get the connection associated with this channel.

Returns:
the connection

writeMessage

MessageOutputStream writeMessage()
                                 throws IOException
Write a new message on to this channel, blocking if necessary.

Returns:
the outbound message to send
Throws:
IOException - if a new message cannot be written

writeShutdown

void writeShutdown()
                   throws IOException
Send an end-of-messages signal to the remote side. No more messages may be written after this method is called; however, more incoming messages may be received.

Throws:
IOException - if the message could not be written

receiveMessage

void receiveMessage(Channel.Receiver handler)
Initiate processing of the next message, when it comes in. This method does not block; instead the handler is called asynchronously (possibly in another thread) if/when the next message arrives.

Parameters:
handler - the handler for the next incoming message

supportsOption

boolean supportsOption(org.xnio.Option<?> option)
Determine whether an option is supported on this channel.

Specified by:
supportsOption in interface org.xnio.channels.Configurable
Parameters:
option - the option
Returns:
true if it is supported

getOption

<T> T getOption(org.xnio.Option<T> option)
Get the value of a channel option.

Specified by:
getOption in interface org.xnio.channels.Configurable
Type Parameters:
T - the type of the option value
Parameters:
option - the option to get
Returns:
the value of the option, or null if it is not set

setOption

<T> T setOption(org.xnio.Option<T> option,
                T value)
            throws IllegalArgumentException
Set an option for this channel. Unsupported options are ignored.

Specified by:
setOption in interface org.xnio.channels.Configurable
Type Parameters:
T - the type of the option value
Parameters:
option - the option to set
value - the value of the option to set
Returns:
the previous option value, if any
Throws:
IllegalArgumentException - if the value is not acceptable for this option

close

void close()
           throws IOException
Close this channel. No more messages may be sent or received after this method is called.

Specified by:
close in interface Closeable
Specified by:
close in interface HandleableCloseable<Channel>
Throws:
IOException - if a failure occurs during close

JBoss Remoting 3 3.2.13.GA-redhat-1

Copyright © 2012 JBoss by Red Hat. All Rights Reserved.