|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ASyncService
An interface to be implemented by services that perform I/O through an ASync instance.
Method Summary | |
---|---|
void |
eventHappens(ASyncServiceEvent event,
long curr_time)
This method is invoked if the time the given ASyncServiceEvent was scheduled to execute at has passed. |
ASyncServiceKey |
getKey()
Returns the ASyncServiceKey object that identifies this
service. |
void |
keyAcceptable(java.nio.channels.SelectionKey sk,
java.nio.channels.SelectableChannel sc,
long curr_time)
This method is invoked by the ASync instance when a channel registered by this service is acceptable. |
void |
keyConnectable(java.nio.channels.SelectionKey sk,
java.nio.channels.SelectableChannel sc,
long curr_time)
This method is invoked by the ASync instance when a channel registered by this service is connectable. |
void |
keyReadable(java.nio.channels.SelectionKey sk,
java.nio.channels.SelectableChannel sc,
long curr_time)
This method is invoked by the ASync instance when a channel registered by this service is readable. |
void |
keyWritable(java.nio.channels.SelectionKey sk,
java.nio.channels.SelectableChannel sc,
long curr_time)
This method is invoked by the ASync instance when a channel registered by this service is writable. |
boolean |
nowRunning(ASyncProvider provider)
This method is invoked when an ASync instance this service is registered with starts running. |
void |
nowStopped()
This method is invoked when the provider with which this service is registered and active stops. |
Method Detail |
---|
ASyncServiceKey getKey()
ASyncServiceKey
object that identifies this
service.
boolean nowRunning(ASyncProvider provider)
ASyncProvider
argument. Note that, while a service may be
registered with multiple ASync instances, it should only use one instance
at a time. If this service is not used by any instance when this method
is invoked, it can commit to using the provider by returning
true
from this method. Otherwise, it can return
false
, and this service will be registered but inactive
with the ASync instance.
provider
- the ASync instance that has now started
true
if this service can participate with the
provider, false
otherwisevoid nowStopped()
SelectableChannel
objects are no longer registered, their
respective keys are invalid, and all unexpired timers have been removed.
The internal state of this service should be reset, allowing it to use
another provider later once its nowRunning
method is
invoked again.
void eventHappens(ASyncServiceEvent event, long curr_time)
ASyncServiceEvent
was scheduled to execute at has passed.
event
- the event that was scheduledcurr_time
- the current time, as last returned by
System.currentTimeMillis()
void keyReadable(java.nio.channels.SelectionKey sk, java.nio.channels.SelectableChannel sc, long curr_time)
SelectionKey.OP_READ
via its associated
SelectionKey
, and the channel has been selected under
this condition.
sk
- the key belonging to the registered SelectableChannel
objectsc
- the SelectableChannel
object that is now readablecurr_time
- the current time, as last returned by
System.currentTimeMillis()
void keyWritable(java.nio.channels.SelectionKey sk, java.nio.channels.SelectableChannel sc, long curr_time)
SelectionKey.OP_WRITE
via its associated
SelectionKey
, and the channel has been selected under
this condition.
sk
- the key belonging to the registered SelectableChannel
objectsc
- the SelectableChannel
object that is now writablecurr_time
- the current time, as last returned by
System.currentTimeMillis()
void keyConnectable(java.nio.channels.SelectionKey sk, java.nio.channels.SelectableChannel sc, long curr_time)
SelectionKey.OP_CONNECT
via its associated
SelectionKey
, and the channel has been selected under
this condition.
sk
- the key belonging to the registered SelectableChannel
objectsc
- the SelectableChannel
object that is now connectablecurr_time
- the current time, as last returned by
System.currentTimeMillis()
void keyAcceptable(java.nio.channels.SelectionKey sk, java.nio.channels.SelectableChannel sc, long curr_time)
SelectionKey.OP_ACCEPT
via its associated
SelectionKey
, and the channel has been selected under
this condition.
sk
- the key belonging to the registered SelectableChannel
objectsc
- the SelectableChannel
object that is now acceptablecurr_time
- the current time, as last returned by
System.currentTimeMillis()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |