Class/Object

zio.nio.channels

Selector

Related Docs: object Selector | package channels

Permalink

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. All

Instance Constructors

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

    Permalink

Type Members

  1. type Env = Any

    Permalink

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  5. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  6. def close(implicit trace: ZTraceElement): IO[IOException, Unit]

    Permalink

    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

    Permalink
    Definition Classes
    AnyRef
  8. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  9. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  10. def foreachSelectedKey[R, E](f: (SelectionKey) ⇒ ZIO[R, E, Boolean])(implicit trace: ZTraceElement): ZIO[R, E, Unit]

    Permalink

    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[_]

    Permalink
    Definition Classes
    AnyRef → Any
  12. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  13. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  14. def isOpen(implicit trace: ZTraceElement): UIO[Boolean]

    Permalink
  15. def keys(implicit trace: ZTraceElement): UIO[Set[SelectionKey]]

    Permalink
    Annotations
    @silent()
  16. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  17. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  18. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  19. def provider(implicit trace: ZTraceElement): UIO[SelectorProvider]

    Permalink
  20. def removeKey(key: SelectionKey)(implicit trace: ZTraceElement): UIO[Unit]

    Permalink
  21. def select(implicit trace: ZTraceElement): IO[IOException, Int]

    Permalink

    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: ZTraceElement): IO[IOException, Int]

    Permalink

    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: ZTraceElement): IO[IOException, Int]

    Permalink

    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: ZTraceElement): UIO[Set[SelectionKey]]

    Permalink

    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.

    Annotations
    @silent()
  25. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  26. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  27. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  28. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  29. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  30. def wakeup(implicit trace: ZTraceElement): IO[Nothing, Unit]

    Permalink

    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