public class SelectorManagerSupport implements SelectorManager
Base class for NIO selector managers
SelectorManager.CompanionCompanion| Modifier and Type | Method and Description |
|---|---|
void |
applyInterest(java.nio.channels.Selector selector,
Selectable s)
Applies selectable's current interest (should be invoked in selection thread)
|
void |
cancelAllSuspensions(Selectable attachment,
java.lang.Throwable t)
Cancel all selectable's suspensions with the specified exception
|
void |
cancelAllSuspensions(java.nio.channels.Selector selector,
java.lang.Throwable t)
Cancel all suspensions with the specified exception, reset all interests
|
int |
getCancelled()
Number of cancelled keys
|
int |
getPending()
Number of pending selectables
|
java.nio.channels.spi.SelectorProvider |
getProvider()
NIO selector provider
|
void |
handleSelectedKey(java.nio.channels.SelectionKey key)
Handles particular selected key
|
void |
handleSelectedKeys(java.util.Set<java.nio.channels.SelectionKey> selectedKeys,
java.util.Set<? extends java.nio.channels.SelectionKey> keys)
Handle selected keys clearing selectedKeys set
|
void |
notifyClosedImpl(java.nio.channels.Selector selector,
java.nio.channels.SelectionKey key,
Selectable attachment)
Notify selectable's closure
|
void |
publishInterest(Selectable selectable)
Publish current selectable interest, any thread
|
java.lang.Object |
select(Selectable selectable,
SelectInterest interest,
kotlin.coroutines.experimental.Continuation<? super kotlin.Unit> p)
Suspends until interest is selected for selectable
May cause manager to allocate and run selector instance if not yet created.
|
void |
setCancelled(int p)
Number of cancelled keys
|
void |
setPending(int p)
Number of pending selectables
|
getProvider, notifyClosed, selectpublic java.nio.channels.spi.SelectorProvider getProvider()
NIO selector provider
public int getPending()
Number of pending selectables
public void setPending(int p)
Number of pending selectables
public int getCancelled()
Number of cancelled keys
public void setCancelled(int p)
Number of cancelled keys
public void publishInterest(Selectable selectable)
Publish current selectable interest, any thread
public java.lang.Object select(Selectable selectable, SelectInterest interest, kotlin.coroutines.experimental.Continuation<? super kotlin.Unit> p)
Suspends until interest is selected for selectable May cause manager to allocate and run selector instance if not yet created.
Only one selection is allowed per interest per selectable but you can select for different interests for the same selectable simultaneously. In other words you can select for read and write at the same time but should never try to read twice for the same selectable.
public void handleSelectedKeys(java.util.Set<java.nio.channels.SelectionKey> selectedKeys,
java.util.Set<? extends java.nio.channels.SelectionKey> keys)
Handle selected keys clearing selectedKeys set
public void handleSelectedKey(java.nio.channels.SelectionKey key)
Handles particular selected key
public void applyInterest(java.nio.channels.Selector selector,
Selectable s)
Applies selectable's current interest (should be invoked in selection thread)
public void notifyClosedImpl(java.nio.channels.Selector selector,
java.nio.channels.SelectionKey key,
Selectable attachment)
Notify selectable's closure
public void cancelAllSuspensions(Selectable attachment, java.lang.Throwable t)
Cancel all selectable's suspensions with the specified exception
public void cancelAllSuspensions(java.nio.channels.Selector selector,
java.lang.Throwable t)
Cancel all suspensions with the specified exception, reset all interests