Java Doc for SelectorProvider.java in  » 6.0-JDK-Core » io-nio » java » nio » channels » spi » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Home
Java Source Code / Java Documentation
1.6.0 JDK Core
2.6.0 JDK Modules
3.6.0 JDK Modules com.sun
4.6.0 JDK Modules com.sun.java
5.6.0 JDK Modules sun
6.6.0 JDK Platform
7.Ajax
8.Apache Harmony Java SE
9.Aspect oriented
10.Authentication Authorization
11.Blogger System
12.Build
13.Byte Code
14.Cache
15.Chart
16.Chat
17.Code Analyzer
18.Collaboration
19.Content Management System
20.Database Client
21.Database DBMS
22.Database JDBC Connection Pool
23.Database ORM
24.Development
25.EJB Server
26.ERP CRM Financial
27.ESB
28.Forum
29.Game
30.GIS
31.Graphic 3D
32.Graphic Library
33.Groupware
34.HTML Parser
35.IDE
36.IDE Eclipse
37.IDE Netbeans
38.Installer
39.Internationalization Localization
40.Inversion of Control
41.Issue Tracking
42.J2EE
43.J2ME
44.JBoss
45.JMS
46.JMX
47.Library
48.Mail Clients
49.Music
50.Net
51.Parser
52.PDF
53.Portal
54.Profiler
55.Project Management
56.Report
57.RSS RDF
58.Rule Engine
59.Science
60.Scripting
61.Search Engine
62.Security
63.Sevlet Container
64.Source Control
65.Swing Library
66.Template Engine
67.Test Coverage
68.Testing
69.UML
70.Web Crawler
71.Web Framework
72.Web Mail
73.Web Server
74.Web Services
75.Web Services apache cxf 2.2.6
76.Web Services AXIS2
77.Wiki Engine
78.Workflow Engines
79.XML
80.XML UI
Java Source Code / Java Documentation » 6.0 JDK Core » io nio » java.nio.channels.spi 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   java.nio.channels.spi.SelectorProvider

SelectorProvider
abstract public class SelectorProvider (Code)
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 system-wide default provider instance, which is returned by the SelectorProvider.provider() provider method. The first invocation of that method will locate the default provider as specified below.

The system-wide default provider is used by the static open methods of the java.nio.channels.DatagramChannel.openDatagramChannel , java.nio.channels.Pipe.open Pipe , java.nio.channels.Selector.open Selector , java.nio.channels.ServerSocketChannel.open ServerSocketChannel , and java.nio.channels.SocketChannel.open SocketChannel classes. It is also used by the java.lang.System.inheritedChannel System.inheritedChannel() method. A program may make use of a provider other than the default provider by instantiating that provider and then directly invoking the open methods defined in this class.

All of the methods in this class are safe for use by multiple concurrent threads.


author:
   Mark Reinhold
author:
   JSR-51 Expert Group
version:
   1.35, 07/05/19
since:
   1.4



Constructor Summary
protected  SelectorProvider()
     Initializes a new instance of this class.

Method Summary
public  ChannelinheritedChannel()
     Returns the channel inherited from the entity that created this Java virtual machine.

On many operating systems a process, such as a Java virtual machine, can be started in a manner that allows the process to inherit a channel from the entity that created the process.

abstract public  DatagramChannelopenDatagramChannel()
     Opens a datagram channel.
abstract public  PipeopenPipe()
     Opens a pipe.
abstract public  AbstractSelectoropenSelector()
     Opens a selector.
abstract public  ServerSocketChannelopenServerSocketChannel()
     Opens a server-socket channel.
abstract public  SocketChannelopenSocketChannel()
     Opens a socket channel.
public static  SelectorProviderprovider()
     Returns the system-wide default selector provider for this invocation of the Java virtual machine.

The first invocation of this method locates the default provider object as follows:

  1. If the system property java.nio.channels.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.



Constructor Detail
SelectorProvider
protected SelectorProvider()(Code)
Initializes a new instance of this class.


throws:
  SecurityException - If a security manager has been installed and it deniesRuntimePermission("selectorProvider")




Method Detail
inheritedChannel
public Channel inheritedChannel() throws IOException(Code)
Returns the channel inherited from the entity that created this Java virtual machine.

On many operating systems a process, such as a Java virtual machine, can be started in a manner that allows the process to inherit a channel from the entity that created the process. The manner in which this is done is system dependent, as are the possible entities to which the channel may be connected. For example, on UNIX systems, the Internet services daemon (inetd) is used to start programs to service requests when a request arrives on an associated network port. In this example, the process that is started, inherits a channel representing a network socket.

In cases where the inherited channel represents a network socket then the java.nio.channels.Channel Channel type returned by this method is determined as follows:

  • If the inherited channel represents a stream-oriented connected socket then a java.nio.channels.SocketChannel SocketChannel is returned. The socket channel is, at least initially, in blocking mode, bound to a socket address, and connected to a peer.

  • If the inherited channel represents a stream-oriented listening socket then a java.nio.channels.ServerSocketChannel ServerSocketChannel is returned. The server-socket channel is, at least initially, in blocking mode, and bound to a socket address.

  • If the inherited channel is a datagram-oriented socket then a java.nio.channels.DatagramChannel DatagramChannel is returned. The datagram channel is, at least initially, in blocking mode, and bound to a socket address.

In addition to the network-oriented channels described, this method may return other kinds of channels in the future.

The first invocation of this method creates the channel that is returned. Subsequent invocations of this method return the same channel.

The inherited channel, if any, otherwise null.
throws:
  IOException - If an I/O error occurs
throws:
  SecurityException - If a security manager has been installed and it deniesRuntimePermission("inheritedChannel")
since:
   1.5



openDatagramChannel
abstract public DatagramChannel openDatagramChannel() throws IOException(Code)
Opens a datagram channel.

The new channel



openPipe
abstract public Pipe openPipe() throws IOException(Code)
Opens a pipe.

The new pipe



openSelector
abstract public AbstractSelector openSelector() throws IOException(Code)
Opens a selector.

The new selector



openServerSocketChannel
abstract public ServerSocketChannel openServerSocketChannel() throws IOException(Code)
Opens a server-socket channel.

The new channel



openSocketChannel
abstract public SocketChannel openSocketChannel() throws IOException(Code)
Opens a socket channel.

The new channel



provider
public static SelectorProvider provider()(Code)
Returns the system-wide default selector provider for this invocation of the Java virtual machine.

The first invocation of this method locates the default provider object as follows:

  1. If the system property java.nio.channels.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.

  2. 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.channels.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.

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

The system-wide default selector provider



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.