org.activeio.adapter
Class AsynchChannelToConcurrentRequestChannel
java.lang.Object
org.activeio.FilterAsynchChannel
org.activeio.adapter.AsynchChannelToConcurrentRequestChannel
- All Implemented Interfaces:
- AsynchChannel, AsynchChannelListener, Channel, Disposable, InputAsynchChannel, OutputChannel, RequestChannel, Service
- public final class AsynchChannelToConcurrentRequestChannel
- extends FilterAsynchChannel
- implements RequestChannel
Creates a RequestChannel
out of a AsynchChannel
. This
RequestChannel
is thread safe and mutiplexes concurrent requests and responses over
the underlying AsynchChannel
.
- Version:
- $Revision$
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
AsynchChannelToConcurrentRequestChannel
public AsynchChannelToConcurrentRequestChannel(AsynchChannel next)
AsynchChannelToConcurrentRequestChannel
public AsynchChannelToConcurrentRequestChannel(AsynchChannel next,
EDU.oswego.cs.dl.util.concurrent.Executor requestExecutor)
getNextRequestId
short getNextRequestId()
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
- Overrides:
write
in class FilterAsynchChannel
- Throws:
java.io.IOException
- See Also:
org.activeio.FilterAsynchChannel#write(org.activeio.channel.Packet)
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
- Overrides:
onPacket
in class FilterAsynchChannel
- See Also:
org.activeio.FilterAsynchChannel#onPacket(org.activeio.channel.Packet)
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
Copyright © -2005 The ActiveIO Project. All Rights Reserved.