|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.activeio.adapter.SynchToAsynchChannelAdapter
Adapts a SynchChannel
so that it provides an
AsynchChannel
interface. When this channel
is started, a background thread is used to poll the SynchChannel
for packets comming up the channel which are then delivered to the
org.activeio.ChannelConsumer
.
Field Summary |
Fields inherited from interface org.activeio.Service |
NO_WAIT_TIMEOUT, WAIT_FOREVER_TIMEOUT |
Constructor Summary | |
SynchToAsynchChannelAdapter(SynchChannel synchChannel)
Deprecated. #adapt(SynchChannel) |
|
SynchToAsynchChannelAdapter(SynchChannel synchChannel,
EDU.oswego.cs.dl.util.concurrent.Executor executor)
Deprecated. #adapt(SynchChannel, Executor) |
Method Summary | |
static AsynchChannel |
adapt(Channel channel)
|
static AsynchChannel |
adapt(Channel channel,
EDU.oswego.cs.dl.util.concurrent.Executor executor)
|
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()
|
SynchChannel |
getSynchChannel()
|
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 |
run()
reads packets from a Socket |
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 |
Constructor Detail |
public SynchToAsynchChannelAdapter(SynchChannel synchChannel)
#adapt(SynchChannel)
public SynchToAsynchChannelAdapter(SynchChannel synchChannel, EDU.oswego.cs.dl.util.concurrent.Executor executor)
#adapt(SynchChannel, Executor)
Method Detail |
public static AsynchChannel adapt(Channel channel)
public static AsynchChannel adapt(Channel channel, EDU.oswego.cs.dl.util.concurrent.Executor executor)
public void start() throws java.io.IOException
Service
start
in interface Service
java.io.IOException
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
public void run()
run
in interface java.lang.Runnable
public void setAsynchChannelListener(AsynchChannelListener channelListener)
InputAsynchChannel
ChannelConsumer
that the protcol will use to deliver packets
comming 'up' the channel.
setAsynchChannelListener
in interface InputAsynchChannel
org.activeio.AsynchChannel#setAsynchChannelListener(org.activeio.UpPacketListener)
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 void dispose()
Disposable
dispose
in interface Disposable
Disposable.dispose()
public AsynchChannelListener getAsynchChannelListener()
getAsynchChannelListener
in interface InputAsynchChannel
public java.lang.Object narrow(java.lang.Class target)
Channel
narrow
in interface Channel
public SynchChannel getSynchChannel()
public java.lang.String toString()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |