|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.activeio.adapter.AsynchToSynchChannelAdapter
Adapts a AsynchChannel
so that it provides an
SynchChannel
interface.
This object buffers asynchronous messages from the AsynchChannel
and buffers them in a Channel
util the client receives them.
Field Summary |
Fields inherited from interface org.activeio.Service |
NO_WAIT_TIMEOUT, WAIT_FOREVER_TIMEOUT |
Constructor Summary | |
AsynchToSynchChannelAdapter(AsynchChannel asynchChannel)
Deprecated. #adapt(AsynchChannel) |
|
AsynchToSynchChannelAdapter(AsynchChannel asynchChannel,
EDU.oswego.cs.dl.util.concurrent.Channel upPacketChannel)
Deprecated. #adapt(AsynchChannel, Channel) |
Method Summary | |
static SynchChannel |
adapt(Channel channel)
|
static SynchChannel |
adapt(Channel channel,
EDU.oswego.cs.dl.util.concurrent.Channel upPacketChannel)
|
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. |
AsynchChannel |
getAsynchChannel()
|
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 |
read(long timeout)
Used to synchonously receive a packet of information going '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 |
Constructor Detail |
public AsynchToSynchChannelAdapter(AsynchChannel asynchChannel)
#adapt(AsynchChannel)
public AsynchToSynchChannelAdapter(AsynchChannel asynchChannel, EDU.oswego.cs.dl.util.concurrent.Channel upPacketChannel)
#adapt(AsynchChannel, Channel)
Method Detail |
public static SynchChannel adapt(Channel channel)
public static SynchChannel adapt(Channel channel, EDU.oswego.cs.dl.util.concurrent.Channel upPacketChannel)
public void write(Packet packet) throws java.io.IOException
OutputChannel
write
in interface OutputChannel
packet
-
java.io.IOException
org.activeio.Channel#write(org.activeio.channel.Packet)
public void flush() throws java.io.IOException
OutputChannel
flush
in interface OutputChannel
java.io.IOException
org.activeio.Channel#flush()
public Packet read(long timeout) throws java.io.IOException
InputSynchChannel
read
in interface InputSynchChannel
timeout
-
java.io.IOException
InputSynchChannel.read(long)
public void dispose()
Disposable
dispose
in interface Disposable
Disposable.dispose()
public void start() throws java.io.IOException
Service
start
in interface Service
java.io.IOException
Service.start()
public void stop(long timeout) throws java.io.IOException
Service
stop
in interface Service
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.
java.io.IOException
Service.stop(long)
public void onPacket(Packet packet)
AsynchChannelListener
AsynchChannel
will call this method to deliver an 'up' packet to a consumer.
onPacket
in interface AsynchChannelListener
packet
- org.activeio.AsynchChannelListener#onPacket(org.activeio.channel.Packet)
public void onPacketError(java.io.IOException error)
AsynchChannelListener
AsynchChannel
will call this method when a async failure occurs in the channel.
onPacketError
in interface AsynchChannelListener
error
- the exception that describes the failure.org.activeio.AsynchChannelListener#onPacketError(org.activeio.channel.ChannelException)
public java.lang.Object narrow(java.lang.Class target)
Channel
narrow
in interface Channel
public AsynchChannel getAsynchChannel()
public java.lang.String toString()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |