java.nio.channels.spi
public
abstract
class
java.nio.channels.spi.SelectorProvider
Provider for nio selector and selectable channel.
The provider can be got by system property or the configuration file in a jar
file, if not, the system default provider will return. The main function of
this class is to return the instance of implementation class of
DatagramChannel
, Pipe
, Selector
,
ServerSocketChannel
, and SocketChannel
. All
the methods of this class are multi-thread safe.
Summary
Protected Constructors
Public Methods
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait
Details
Protected Constructors
protected
SelectorProvider()
Constructor for this class.
Throws
SecurityException
| If there is a security manager, and it denies
RuntimePermission("selectorProvider").
|
Public Methods
public
Channel
inheritedChannel()
Answer the channel inherited from the instance which created this JVM.
Throws
IOException
| If some I/O exception occurred. |
SecurityException
| If there is a security manager, and it denies
RuntimePermission("selectorProvider").
|
public
abstract
DatagramChannel
openDatagramChannel()
Create a new open
DatagramChannel
.
public
abstract
Pipe
openPipe()
public
abstract
ServerSocketChannel
openServerSocketChannel()
Create a new open
ServerSocketChannel
.
public
abstract
SocketChannel
openSocketChannel()
Create a new open
SocketChannel
.
public
static
synchronized
SelectorProvider
provider()
Get the provider by following steps in the first calling.
- If the system property "java.nio.channels.spi.SelectorProvider" is
set, the value of this property is the class name of the return provider.
- If there is a provider-configuration file named
"java.nio.channels.spi.SelectorProvider" in META-INF/services of some jar
file valid in the system class loader, the first class name is the return
provider's class name.
- Otherwise, a system default provider will be returned.