|
JavaTM 2 Platform Std. Ed. v1.4.0 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.nio.channels.spi.SelectorProvider
Service-provider class for selectors and selectable channels.
A selector provider is a concrete subclass of this class that has a
zero-argument constructor and implements the abstract methods specified
below. A given invocation of the Java virtual machine maintains a single
provider instance, which is returned by the provider
method. The first invocation of that method will locate the provider object
as specified below.
All of the methods in this class are safe for use by multiple concurrent threads.
Constructor Summary | |
protected |
SelectorProvider()
Initializes a new instance of this class. |
Method Summary | |
abstract DatagramChannel |
openDatagramChannel()
Opens a datagram channel. |
abstract Pipe |
openPipe()
Opens a pipe. |
abstract AbstractSelector |
openSelector()
Opens a selector. |
abstract ServerSocketChannel |
openServerSocketChannel()
Opens a server-socket channel. |
abstract SocketChannel |
openSocketChannel()
Opens a socket channel. |
static SelectorProvider |
provider()
Returns the selector provider for this invocation of the Java virtual machine. |
static void |
setProvider(SelectorProvider provider)
Sets the system-wide selector provider. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
protected SelectorProvider()
Method Detail |
public static void setProvider(SelectorProvider provider)
provider
- The provider to be used; must not be null
IllegalStateException
- If a provider for this invocation of the Java virtual machine
has already been determined
SecurityException
- If a security manager has been installed and it denies
RuntimePermission
("selectorProvider")public static SelectorProvider provider()
The first invocation of this method locates the system-wide provider object as follows:
If the setProvider
method has been
succesfully invoked then the supplied provider is returned.
If the system property java.nio.spi.SelectorProvider is defined then it is taken to be the fully-qualified name of a concrete provider class. The class is loaded and instantiated; if this process fails then an unspecified error is thrown.
If a provider class has been installed in a jar file that is visible to the system class loader, and that jar file contains a provider-configuration file named java.nio.spi.SelectorProvider in the resource directory META-INF/services, then the first class name specified in that file is taken. The class is loaded and instantiated; if this process fails then an unspecified error is thrown.
Finally, if no provider has been specified by any of the above means then the system-default provider class is instantiated and the result is returned.
Subsequent invocations of this method return the provider that was returned by the first invocation.
public abstract DatagramChannel openDatagramChannel() throws IOException
IOException
public abstract Pipe openPipe() throws IOException
IOException
public abstract AbstractSelector openSelector() throws IOException
IOException
public abstract ServerSocketChannel openServerSocketChannel() throws IOException
IOException
public abstract SocketChannel openSocketChannel() throws IOException
IOException
|
JavaTM 2 Platform Std. Ed. v1.4.0 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Java, Java 2D, and JDBC are trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-2001 Sun Microsystems, Inc. 901 San Antonio Road
Palo Alto, California, 94303, U.S.A. All Rights Reserved.