org.restlet.engine.io

## Class SelectorFactory

- java.lang.Object
- - org.restlet.engine.io.SelectorFactory

    public class SelectorFactory
    extends java.lang.Object

Factory used to dispatch/share `Selector`.

Author:
  Jean-Francois Arcand

### Field Summary

Fields
`static int` `MAX_ATTEMPTS` The number of attempts to find an available selector.
`static int` `MAX_SELECTORS` The maximum number of `Selector` to create.
`static long` `TIMEOUT` The timeout before we exit.

### Constructor Summary

Constructors
Constructor and Description
`SelectorFactory()`

### Method Summary

Methods
`static java.nio.channels.Selector` `getSelector()` Get an exclusive `Selector`.
`static void` `returnSelector(java.nio.channels.Selector selector)` Returns the `Selector` to the cache.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### MAX_SELECTORS

    public static final int MAX_SELECTORS

The maximum number of `Selector` to create.

See Also:
  Constant Field Values

#### MAX_ATTEMPTS

    public static final int MAX_ATTEMPTS

The number of attempts to find an available selector.

See Also:
  Constant Field Values

#### TIMEOUT

    public static final long TIMEOUT

The timeout before we exit.

See Also:
  Constant Field Values

### Constructor Detail

#### SelectorFactory

    public SelectorFactory()

### Method Detail

#### getSelector

    public static final java.nio.channels.Selector getSelector()

Get an exclusive `Selector`.

Returns:
  An exclusive `Selector`.

#### returnSelector

    public static final void returnSelector(java.nio.channels.Selector selector)

Returns the `Selector` to the cache.

Parameters:
  `selector` - The `Selector` to return.