|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.activeio.adapter.AsyncToSyncChannel
public final class AsyncToSyncChannel
Adapts a AsyncChannel so that it provides an
org.activeio.SynchChannel interface.
This object buffers asynchronous messages from the AsyncChannel
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 |
| Fields inherited from interface org.activeio.Service |
|---|
NO_WAIT_TIMEOUT, WAIT_FOREVER_TIMEOUT |
| Constructor Summary | |
|---|---|
AsyncToSyncChannel(AsyncChannel asyncChannel)
Deprecated. #adapt(AsyncChannel) |
|
AsyncToSyncChannel(AsyncChannel asyncChannel,
Channel upPacketChannel)
Deprecated. #adapt(AsyncChannel, Channel) |
|
| Method Summary | |
|---|---|
static SyncChannel |
adapt(Channel channel)
|
static SyncChannel |
adapt(Channel channel,
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. |
AsyncChannel |
getAsyncChannel()
|
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 |
onPacket(Packet packet)
A AsyncChannel will call this method to deliver an 'up' packet to a consumer. |
void |
onPacketError(IOException error)
A AsyncChannel will call this method when a async failure occurs in the channel. |
Packet |
read(long timeout)
Used to synchronously receive a packet of information going '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 AsyncToSyncChannel(AsyncChannel asyncChannel)
#adapt(AsyncChannel)
public AsyncToSyncChannel(AsyncChannel asyncChannel,
Channel upPacketChannel)
#adapt(AsyncChannel, Channel)
| Method Detail |
|---|
public static SyncChannel adapt(Channel channel)
public static SyncChannel adapt(Channel channel,
Channel upPacketChannel)
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 Packet read(long timeout)
throws IOException
InputSyncChannel
read in interface InputSyncChannelIOExceptionInputSyncChannel.read(long)public void dispose()
Disposable
dispose in interface DisposableDisposable.dispose()
public void start()
throws IOException
Service
start in interface ServiceIOExceptionService.start()
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.
IOExceptionService.stop(long)public void onPacket(Packet packet)
AsyncChannelListenerAsyncChannel will call this method to deliver an 'up' packet to a consumer.
onPacket in interface AsyncChannelListenerAsyncChannelListener.onPacket(org.activeio.Packet)public void onPacketError(IOException error)
AsyncChannelListenerAsyncChannel will call this method when a async failure occurs in the channel.
onPacketError in interface AsyncChannelListenererror - the exception that describes the failure.org.activeio.AsyncChannelListener#onPacketError(org.activeio.ChannelException)public Object narrow(Class target)
Channel
narrow in interface Channelpublic AsyncChannel getAsyncChannel()
public String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||