sok / Sok.Selector / SelectorPool
class SelectorPool
(source)
Platform and version requirements: JVM
A SelectorPool will order the Selectors by the number of channels registered. This allow us to do a basic load balancing between all the Selectors
<init> | SelectorPool(NbrOfSelector: Int ) A SelectorPool will order the Selectors by the number of channels registered. This allow us to do a basic load balancing between all the Selectors |
isClosed | var isClosed: Boolean state of the pool |
close | fun close(): Unit Close the pool and all the selectors inside it |
getLessbusySelector | suspend fun getLessbusySelector(): Selector Get the less busy selector (first in the pool list), the method is suspending because an actor is used behind the scene to allow multiple threads accessing the pool and still get the right selector. This may not be the most efficient way to do it but a socket get a selector once so it is not critical. |