|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.activeio.adapter.SyncToAsyncChannelServer
public final class SyncToAsyncChannelServer
Adapts a org.activeio,SynchChannelServer
so that it provides an
AsyncChannelServer
interface. When this channel
is started, a background thread is used to poll the (@see org.activeio.SynchChannelServer}
for accepted channel connections which are then delivered to the org.activeio.AcceptConsumer
.
Field Summary |
---|
Fields inherited from interface org.activeio.Service |
---|
NO_WAIT_TIMEOUT, WAIT_FOREVER_TIMEOUT |
Constructor Summary | |
---|---|
SyncToAsyncChannelServer(SyncChannelServer syncServer)
|
|
SyncToAsyncChannelServer(SyncChannelServer syncServer,
Executor executor)
|
Method Summary | |
---|---|
static AsyncChannelServer |
adapt(ChannelServer channel)
|
static AsyncChannelServer |
adapt(ChannelServer channel,
Executor executor)
|
void |
dispose()
This method should not throw any exceptions. |
URI |
getBindURI()
The URI that was used when the channel was bound. |
URI |
getConnectURI()
Once bound, the channel may be able to construct a URI that is more sutible for when a client needs to connect to the server. |
SyncChannelServer |
getSynchChannelServer()
|
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()
|
void |
setAcceptListener(AcceptListener acceptListener)
Registers an AcceptListener which is notified of accepted channels. |
void |
start()
Starts the channel. |
void |
stop(long timeout)
Stops the channel. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public SyncToAsyncChannelServer(SyncChannelServer syncServer)
public SyncToAsyncChannelServer(SyncChannelServer syncServer, Executor executor)
Method Detail |
---|
public static AsyncChannelServer adapt(ChannelServer channel)
public static AsyncChannelServer adapt(ChannelServer channel, Executor executor)
public void start() throws IOException
Service
start
in interface Service
IOException
public void stop(long timeout) throws 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.
IOException
public void run()
run
in interface Runnable
public void setAcceptListener(AcceptListener acceptListener)
AsyncChannelServer
setAcceptListener
in interface AsyncChannelServer
AsyncChannelServer.setAcceptListener(org.activeio.AcceptListener)
public void dispose()
Disposable
dispose
in interface Disposable
Disposable.dispose()
public URI getBindURI()
ChannelServer
getBindURI
in interface ChannelServer
public URI getConnectURI()
ChannelServer
getConnectURI
in interface ChannelServer
public SyncChannelServer getSynchChannelServer()
public Object narrow(Class target)
Channel
narrow
in interface Channel
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |