Packages

final class Selector extends IOCloseable

A multiplexor of SelectableChannel objects.

Please thoroughly read the documentation for the underlying Java API before attempting to use this.

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Selector
  2. IOCloseable
  3. AnyRef
  4. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new Selector(selector: java.nio.channels.Selector)

Type Members

  1. type Env = Any

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native()
  6. def close(implicit trace: Trace): IO[IOException, Unit]

    Closes this selector.

    Closes this selector.

    If a thread is currently blocked in one of this selector's selection methods then it is interrupted as if by invoking the selector's wakeup method. Any uncancelled keys still associated with this selector are invalidated, their channels are deregistered, and any other resources associated with this selector are released. If this selector is already closed then invoking this method has no effect. After a selector is closed, any further attempt to use it, except by invoking this method or the wakeup method, will cause a ClosedSelectorException to be raised as a defect.

    Definition Classes
    SelectorIOCloseable
  7. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  8. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  9. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable])
  10. def foreachSelectedKey[R, E](f: (SelectionKey) => ZIO[R, E, Boolean])(implicit trace: Trace): ZIO[R, E, Unit]

    Performs an effect with each selected key.

    Performs an effect with each selected key.

    If the result of effect is true, the key will be removed from the selected-key set, which is usually what you want after successfully handling a selected key.

  11. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  12. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  13. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  14. def isOpen(implicit trace: Trace): UIO[Boolean]
  15. def keys(implicit trace: Trace): UIO[Set[SelectionKey]]
  16. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  17. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  18. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  19. def provider(implicit trace: Trace): UIO[SelectorProvider]
  20. def removeKey(key: SelectionKey)(implicit trace: Trace): UIO[Unit]
  21. def select(implicit trace: Trace): IO[IOException, Int]

    Performs a blocking select operation.

    Performs a blocking select operation.

    **Note this will very often block**. This is intended to be used when the effect is locked to an Executor that is appropriate for this. If the fiber is interrupted while blocked in select, then wakeup is used to unblock it.

    Dies with ClosedSelectorException if this selector is closed.

    returns

    The number of keys, possibly zero, whose ready-operation sets were updated

  22. def select(timeout: zio.Duration)(implicit trace: Trace): IO[IOException, Int]

    Performs a blocking select operation.

    Performs a blocking select operation.

    **Note this will very often block**. This is intended to be used when the effect is locked to an Executor that is appropriate for this. If the fiber is interrupted while blocked in select, then wakeup is used to unblock it.

    Dies with ClosedSelectorException if this selector is closed.

    returns

    The number of keys, possibly zero, whose ready-operation sets were updated

  23. def selectNow(implicit trace: Trace): IO[IOException, Int]

    Selects a set of keys whose corresponding channels are ready for I/O operations.

    Selects a set of keys whose corresponding channels are ready for I/O operations. This method performs a non-blocking selection operation. If no channels have become selectable since the previous selection operation then this method immediately returns zero.

    returns

    The number of keys, possibly zero, whose ready-operation sets were updated by the selection operation.

  24. def selectedKeys(implicit trace: Trace): UIO[Set[SelectionKey]]

    Returns this selector's selected-key set.

    Returns this selector's selected-key set.

    Note that the returned set it mutable - keys may be removed from, but not directly added to it. Any attempt to add an object to the key set will cause an UnsupportedOperationException to be thrown. The selected-key set is not thread-safe.

  25. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  26. def toString(): String
    Definition Classes
    AnyRef → Any
  27. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  28. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  29. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  30. def wakeup(implicit trace: Trace): IO[Nothing, Unit]

    Causes the first selection operation that has not yet returned to return immediately.

    Causes the first selection operation that has not yet returned to return immediately.

    If another thread is currently blocked in an invocation of the select() or select(long) methods then that invocation will return immediately. If no selection operation is currently in progress then the next invocation of one of these methods will return immediately unless the selectNow() method is invoked in the meantime. In any case the value returned by that invocation may be non-zero. Subsequent invocations of the select() or select(long) methods will block as usual unless this method is invoked again in the meantime. Invoking this method more than once between two successive selection operations has the same effect as invoking it just once.

Inherited from IOCloseable

Inherited from AnyRef

Inherited from Any

Ungrouped