org.activeio.adapter
Class AsyncChannelToConcurrentRequestChannel
java.lang.Object
org.activeio.FilterAsyncChannel
org.activeio.adapter.AsyncChannelToConcurrentRequestChannel
- All Implemented Interfaces:
- AsyncChannel, AsyncChannelListener, Channel, Disposable, InputAsyncChannel, OutputChannel, RequestChannel, Service
public final class AsyncChannelToConcurrentRequestChannel
- extends FilterAsyncChannel
- implements RequestChannel
Creates a RequestChannel
out of a AsyncChannel
. This
RequestChannel
is thread safe and mutiplexes concurrent requests and responses over
the underlying AsyncChannel
.
- Version:
- $Revision$
AsyncChannelToConcurrentRequestChannel
public AsyncChannelToConcurrentRequestChannel(AsyncChannel next)
AsyncChannelToConcurrentRequestChannel
public AsyncChannelToConcurrentRequestChannel(AsyncChannel next,
Executor requestExecutor)
write
public void write(Packet packet)
throws IOException
- Description copied from interface:
OutputChannel
- Sends a packet down the channel towards the media.
- Specified by:
write
in interface OutputChannel
- Overrides:
write
in class FilterAsyncChannel
- Throws:
IOException
- See Also:
FilterAsyncChannel.write(org.activeio.Packet)
onPacket
public void onPacket(Packet packet)
- Description copied from interface:
AsyncChannelListener
- A
AsyncChannel
will call this method to deliver an 'up' packet to a consumer.
- Specified by:
onPacket
in interface AsyncChannelListener
- Overrides:
onPacket
in class FilterAsyncChannel
- See Also:
FilterAsyncChannel.onPacket(org.activeio.Packet)
request
public Packet request(Packet request,
long timeout)
throws 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
- Returns:
- the respnse packet or null if the timeout occured.
- Throws:
IOException
setRequestListener
public void setRequestListener(RequestListener requestListener)
throws 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:
IOException
getRequestListener
public RequestListener getRequestListener()
- Specified by:
getRequestListener
in interface RequestChannel
- Returns:
- the registered RequestListener
Copyright © -2009 The ActiveIO Project. All Rights Reserved.