Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.activeio.adapter
Class AsynchChannelToServerRequestChannel

    java.lang.Object
      org.activeio.adapter.AsynchChannelToServerRequestChannel

All Implemented Interfaces:
  AsynchChannelListener, Channel, Disposable, RequestChannel, Service

public class AsynchChannelToServerRequestChannel
extends java.lang.Object
implements RequestChannel, AsynchChannelListener

Creates a `RequestChannel` out of a `AsynchChannel`. Does not support sending requests. It can only be used to handle requests.

Version:
  $Revision$

Field Summary

Fields inherited from interface org.activeio.Service
`NO_WAIT_TIMEOUT, WAIT_FOREVER_TIMEOUT`

Constructor Summary
`AsynchChannelToServerRequestChannel(AsynchChannel next)`

Method Summary
`void` | `dispose()` This method should not throw any exceptions.
`RequestListener` | `getRequestListener()`
`java.lang.Object` | `narrow(java.lang.Class target)` Since a Channel may be composed from a chain of other Channel obejcts, this method allows you to query the chain for the specified interface.
`void` | `onPacket(Packet packet)` A `AsynchChannel` will call this method to deliver an 'up' packet to a consumer.
`void` | `onPacketError(java.io.IOException error)` A `AsynchChannel` will call this method when a async failure occurs in the channel.
`Packet` | `request(Packet request, long timeout)` Used to send a packet of information going 'down' the channel and wait for it's reponse 'up' packet.
`void` | `setRequestListener(RequestListener requestListener)` Registers the `RequestListener` that the protcol will use to deliver request packets comming 'up' the channel.
`void` | `start()` Starts the channel.
`void` | `stop(long timeout)` Stops the channel.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### AsynchChannelToServerRequestChannel

    public AsynchChannelToServerRequestChannel(AsynchChannel next)
                                        throws java.io.IOException

Method Detail

### request

    public Packet request(Packet request,
                          long timeout)
                   throws java.io.IOException

  Description copied from interface: `RequestChannel`
  Used to send a packet of information going 'down' the channel and wait for it's reponse 'up' packet. This method blocks until the response packet is received or the operation experiences a timeout.

  Specified by:
    `request` in interface `RequestChannel`
  Parameters:
    `request` -
    `timeout` -
  Returns:
    the respnse packet or null if the timeout occured.
  Throws:
    `java.io.IOException`

### setRequestListener

    public void setRequestListener(RequestListener requestListener)
                            throws java.io.IOException

  Description copied from interface: `RequestChannel`
  Registers the `RequestListener` that the protcol will use to deliver request packets comming 'up' the channel.

  Specified by:
    `setRequestListener` in interface `RequestChannel`
  Throws:
    `java.io.IOException`

### getRequestListener

    public RequestListener getRequestListener()

  Specified by:
    `getRequestListener` in interface `RequestChannel`
  Returns:
    the registered RequestListener

### narrow

    public java.lang.Object narrow(java.lang.Class target)

  Description copied from interface: `Channel`
  Since a Channel may be composed from a chain of other Channel obejcts, this method allows you to query the chain for the specified interface. The first Channel in the chain the implments the requested interface will be return an implementing object. If no Channel in the chain implements the requested class, then null is returned.

  Specified by:
    `narrow` in interface `Channel`

### dispose

    public void dispose()

  Description copied from interface: `Disposable`
  This method should not throw any exceptions. Cleaning up a Disposable object should be easy of an end user therefore do not make him have to handle an Exception.

  Specified by:
    `dispose` in interface `Disposable`

### start

    public void start()
               throws java.io.IOException

  Description copied from interface: `Service`
  Starts the channel. Once started, the channel is in the running state.

  Specified by:
    `start` in interface `Service`
  Throws:
    `java.io.IOException`

### stop

    public void stop(long timeout)
              throws java.io.IOException

  Description copied from interface: `Service`
  Stops the channel. Once stopped, the channel is in the stopped state.

  Specified by:
    `stop` in interface `Service`
  Parameters:
    `timeout` - The amount of time the channel is allowed to take to gracefully stop. If the timeout is exceeded, the channel should do a forcefull stop.
  Throws:
    `java.io.IOException`

### onPacket

    public void onPacket(Packet packet)

  Description copied from interface: `AsynchChannelListener`
  A `AsynchChannel` will call this method to deliver an 'up' packet to a consumer.

  Specified by:
    `onPacket` in interface `AsynchChannelListener`
  Parameters:
    `packet` -

### onPacketError

    public void onPacketError(java.io.IOException error)

  Description copied from interface: `AsynchChannelListener`
  A `AsynchChannel` will call this method when a async failure occurs in the channel.

  Specified by:
    `onPacketError` in interface `AsynchChannelListener`
  Parameters:
    `error` - the exception that describes the failure.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © -2005 The ActiveIO Project. All Rights Reserved.