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
Class FilterAsynchChannel

    java.lang.Object
      org.activeio.FilterAsynchChannel

All Implemented Interfaces:
  AsynchChannel, AsynchChannelListener, Channel, Disposable, InputAsynchChannel, OutputChannel, Service

Direct Known Subclasses:
  AsynchChannelToConcurrentRequestChannel, AsynchWriteAsynchChannelAdapter, CounterAsyncChannel, PacketAggregatingAsynchChannel, SynchornizedAsynchChannel, WriteBufferedAsynchChannel

public class FilterAsynchChannel
extends java.lang.Object
implements AsynchChannel, AsynchChannelListener

A AsynchChannelFilter can be used as a filter between a `AsynchChannel` and it's `org.activeio.ChannelConsumer`. Most `AsynchChannel` that are not directly accessing the network will extends the AsynchChannelFilter since they act as a filter between the client and the network. O

Version:
  $Revision$

Field Summary
`protected AsynchChannelListener` | `channelListener`
`protected AsynchChannel` | `next`

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

Constructor Summary
`FilterAsynchChannel(AsynchChannel next)`

Method Summary
`void` | `dispose()` This method should not throw any exceptions.
`void` | `flush()` Some channels may buffer data which may be sent down if flush() is called.
`AsynchChannelListener` | `getAsynchChannelListener()`
`AsynchChannel` | `getNext()`
`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.
`void` | `setAsynchChannelListener(AsynchChannelListener channelListener)` Registers the `ChannelConsumer` that the protcol will use to deliver packets comming 'up' the channel.
`void` | `start()` Starts the channel.
`void` | `stop(long timeout)` Stops the channel.
`java.lang.String` | `toString()`
`void` | `write(Packet packet)` Sends a packet down the channel towards the media.

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

Field Detail

### next

    protected final AsynchChannel next

### channelListener

    protected AsynchChannelListener channelListener

Constructor Detail

### FilterAsynchChannel

    public FilterAsynchChannel(AsynchChannel next)

Method Detail

### setAsynchChannelListener

    public void setAsynchChannelListener(AsynchChannelListener channelListener)

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

  Specified by:
    `setAsynchChannelListener` in interface `InputAsynchChannel`

### write

    public void write(Packet packet)
               throws java.io.IOException

  Description copied from interface: `OutputChannel`
  Sends a packet down the channel towards the media.

  Specified by:
    `write` in interface `OutputChannel`
  Parameters:
    `packet` -
  Throws:
    `java.io.IOException`
  See Also:
    `org.activeio.Channel#write(org.activeio.channel.Packet)`

### flush

    public void flush()
               throws java.io.IOException

  Description copied from interface: `OutputChannel`
  Some channels may buffer data which may be sent down if flush() is called.

  Specified by:
    `flush` in interface `OutputChannel`
  Throws:
    `java.io.IOException`
  See Also:
    `org.activeio.Channel#flush()`

### 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`
  See Also:
    `Disposable.dispose()`

### 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` - if the next channel has not been set.
  See Also:
    `Service.start()`

### 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`
  See Also:
    `Service.stop(long)`

### 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` -
  See Also:
    `org.activeio.AsynchChannelListener#onPacket(org.activeio.channel.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.
  See Also:
    `org.activeio.AsynchChannelListener#onPacketError(org.activeio.channel.ChannelException)`

### getNext

    public AsynchChannel getNext()

  Returns:
    Returns the next.

### getAsynchChannelListener

    public AsynchChannelListener getAsynchChannelListener()

  Specified by:
    `getAsynchChannelListener` in interface `InputAsynchChannel`
  Returns:
    Returns the packetListener.

### 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`

### toString

    public java.lang.String toString()

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.