org.apache.geronimo.remoting.transport.async.nio
Class NonBlockingChannel

java.lang.Object
  extended byorg.apache.geronimo.proxy.SimpleComponent
      extended byorg.apache.geronimo.remoting.transport.async.nio.NonBlockingChannel
All Implemented Interfaces:
Channel, org.apache.geronimo.core.service.Component, SelectionEventListner, Serializable

public class NonBlockingChannel
extends org.apache.geronimo.proxy.SimpleComponent
implements Channel, SelectionEventListner

The Blocking implementation of the AsynchChannel interface. This implemenation uses the standard Java 1.3 blocking socket IO.

Version:
$Revision: 1.3 $ $Date: 2004/03/10 09:59:20 $
See Also:
Serialized Form

Constructor Summary
NonBlockingChannel()
           
 
Method Summary
 void close()
          Starts to terminate the connection.
 AsyncMsg deserialize(ByteBuffer[] message)
           
 URI getRemoteURI()
           
 URI getRequestedURI()
           
 void init(URI localURI, SocketChannel socketChannel)
           
 void open(ChannelListner listner)
          starts an accepted connection.
 void open(URI remoteURI, URI backConnectURI, ChannelListner listner)
          opens a connection to another server.
 void selectionEvent(SelectionKey selection)
          When the SelectorKey is triggered, the service method will be called on the attachment.
 void send(AsyncMsg data)
          Sends an asynch packet of data down the channel.
 
Methods inherited from class org.apache.geronimo.proxy.SimpleComponent
getContainer, getObjectName, setContainer, setObjectName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NonBlockingChannel

public NonBlockingChannel()
Method Detail

open

public void open(URI remoteURI,
                 URI backConnectURI,
                 ChannelListner listner)
          throws TransportException
Description copied from interface: Channel
opens a connection to another server.

Specified by:
open in interface Channel
Parameters:
remoteURI -
listner -
Throws:
TransportException

init

public void init(URI localURI,
                 SocketChannel socketChannel)
          throws IOException,
                 URISyntaxException
Throws:
IOException
URISyntaxException

open

public void open(ChannelListner listner)
          throws TransportException
Description copied from interface: Channel
starts an accepted connection.

Specified by:
open in interface Channel
Parameters:
listner -
Throws:
TransportException

deserialize

public AsyncMsg deserialize(ByteBuffer[] message)
                     throws IOException
Throws:
IOException

close

public void close()
Starts to terminate the connection. Lets the remote end know that we are closing. The client side calls this close. Could be called in response to 2 events: - the remote sever initiated the close(). (so we finish the close) - we initiated the close() (so we wait for the remote side to finish the close) We keep state to know if we started the socket close().

Specified by:
close in interface Channel

getRemoteURI

public URI getRemoteURI()
Returns:

selectionEvent

public void selectionEvent(SelectionKey selection)
Description copied from interface: SelectionEventListner
When the SelectorKey is triggered, the service method will be called on the attachment.

Specified by:
selectionEvent in interface SelectionEventListner

send

public void send(AsyncMsg data)
          throws TransportException
Description copied from interface: Channel
Sends an asynch packet of data down the channel. It does not wait wait for a response if possible.

Specified by:
send in interface Channel
Throws:
TransportException

getRequestedURI

public URI getRequestedURI()
Returns:


Copyright © 2003-2005 Apache Software Foundation. All Rights Reserved.