|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.activeio.adapter.SyncToAsyncChannel
public class SyncToAsyncChannel
Adapts a org.activeio.SynchChannel so that it provides an
AsyncChannel interface. When this channel
is started, a background thread is used to poll the org.activeio.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 |
| Fields inherited from interface org.activeio.Service |
|---|
NO_WAIT_TIMEOUT, WAIT_FOREVER_TIMEOUT |
| Constructor Summary | |
|---|---|
SyncToAsyncChannel(SyncChannel syncChannel)
Deprecated. #adapt(SynchChannel) |
|
SyncToAsyncChannel(SyncChannel syncChannel,
Executor executor)
Deprecated. #adapt(SynchChannel, Executor) |
|
| Method Summary | |
|---|---|
static AsyncChannel |
adapt(Channel channel)
|
static AsyncChannel |
adapt(Channel channel,
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. |
AsyncChannelListener |
getAsyncChannelListener()
|
SyncChannel |
getSynchChannel()
|
Object |
narrow(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 |
setAsyncChannelListener(AsyncChannelListener channelListener)
Registers the ChannelConsumer that the protcol will use to deliver packets
coming 'up' the channel. |
void |
start()
Starts the channel. |
void |
stop(long timeout)
Stops the channel. |
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 SyncToAsyncChannel(SyncChannel syncChannel)
#adapt(SynchChannel)
public SyncToAsyncChannel(SyncChannel syncChannel,
Executor executor)
#adapt(SynchChannel, Executor)
| Method Detail |
|---|
public static AsyncChannel adapt(Channel channel)
public static AsyncChannel adapt(Channel channel,
Executor executor)
public void start()
throws IOException
Service
start in interface ServiceIOException
public void stop(long timeout)
throws IOException
Service
stop in interface Servicetimeout - 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.
IOExceptionpublic void run()
run in interface Runnablepublic void setAsyncChannelListener(AsyncChannelListener channelListener)
InputAsyncChannelChannelConsumer that the protcol will use to deliver packets
coming 'up' the channel.
setAsyncChannelListener in interface InputAsyncChannelorg.activeio.AsyncChannel#setAsyncChannelListener(org.activeio.UpPacketListener)
public void write(Packet packet)
throws IOException
OutputChannel
write in interface OutputChannelIOExceptionorg.activeio.Channel#write(org.activeio.Packet)
public void flush()
throws IOException
OutputChannel
flush in interface OutputChannelIOExceptionorg.activeio.Channel#flush()public void dispose()
Disposable
dispose in interface DisposableDisposable.dispose()public AsyncChannelListener getAsyncChannelListener()
getAsyncChannelListener in interface InputAsyncChannelpublic Object narrow(Class target)
Channel
narrow in interface Channelpublic SyncChannel getSynchChannel()
public String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||