Name

SelectorProvider

Synopsis

This class is the central service-provider class for the channels and selectors of the java.nio.channels API. A concrete subclass of SelectorProvider implements factory methods that return open socket channels, server socket channels, datagram channels, pipes (with their two internal channels) and Selector objects. There is one default SelectorProvider object per JVM: this object can be obtained with the static SelectorProvider.provider( ) method.

You can specify a custom SelectorProvider implementation by setting its class name as the value of the system property java.nio.channels.spi.SelectorProvider. Or, you can put the class name in a file named META-INF/services/java.nio.channels.spi.SelectorProvider, in your application’s JAR file. The provider( ) method first looks for the system property, then looks for the JAR file entry. If it finds neither, it instantiates the implementation’s default SelectorProvider.

Applications are not required to use the default SelectorProvider exclusively. It is legal to instantiate other SelectorProvider objects and explictly invoke their open( ) methods to create channels in that way.

public abstract class SelectorProvider {
// Protected Constructors
     protected SelectorProvider( );  
// Public Class Methods
     public static SelectorProvider provider( );  
// Public Instance Methods
                  5.0  public java.nio.channels.Channel inheritedChannel( ) throws java.io.
        IOException;     constant public abstract java.nio.channels.DatagramChannel ...

Get Java in a Nutshell, 5th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.