< prev index next >

src/java.base/share/classes/java/nio/channels/spi/SelectorProvider.java

Print this page




  78         return null;
  79     }
  80     private SelectorProvider(Void ignore) { }
  81 
  82     /**
  83      * Initializes a new instance of this class.
  84      *
  85      * @throws  SecurityException
  86      *          If a security manager has been installed and it denies
  87      *          {@link RuntimePermission}{@code ("selectorProvider")}
  88      */
  89     protected SelectorProvider() {
  90         this(checkPermission());
  91     }
  92 
  93     private static boolean loadProviderFromProperty() {
  94         String cn = System.getProperty("java.nio.channels.spi.SelectorProvider");
  95         if (cn == null)
  96             return false;
  97         try {
  98             Class<?> c = Class.forName(cn, true,
  99                                        ClassLoader.getSystemClassLoader());
 100             provider = (SelectorProvider)c.newInstance();

 101             return true;
 102         } catch (ClassNotFoundException x) {
 103             throw new ServiceConfigurationError(null, x);
 104         } catch (IllegalAccessException x) {
 105             throw new ServiceConfigurationError(null, x);
 106         } catch (InstantiationException x) {
 107             throw new ServiceConfigurationError(null, x);
 108         } catch (SecurityException x) {
 109             throw new ServiceConfigurationError(null, x);
 110         }
 111     }
 112 
 113     private static boolean loadProviderAsService() {
 114 
 115         ServiceLoader<SelectorProvider> sl =
 116             ServiceLoader.load(SelectorProvider.class,
 117                                ClassLoader.getSystemClassLoader());
 118         Iterator<SelectorProvider> i = sl.iterator();
 119         for (;;) {
 120             try {




  78         return null;
  79     }
  80     private SelectorProvider(Void ignore) { }
  81 
  82     /**
  83      * Initializes a new instance of this class.
  84      *
  85      * @throws  SecurityException
  86      *          If a security manager has been installed and it denies
  87      *          {@link RuntimePermission}{@code ("selectorProvider")}
  88      */
  89     protected SelectorProvider() {
  90         this(checkPermission());
  91     }
  92 
  93     private static boolean loadProviderFromProperty() {
  94         String cn = System.getProperty("java.nio.channels.spi.SelectorProvider");
  95         if (cn == null)
  96             return false;
  97         try {
  98             @SuppressWarnings("deprecation")
  99             Object tmp = Class.forName(cn, true,
 100                                        ClassLoader.getSystemClassLoader()).newInstance();
 101             provider = (SelectorProvider)tmp;
 102             return true;
 103         } catch (ClassNotFoundException x) {
 104             throw new ServiceConfigurationError(null, x);
 105         } catch (IllegalAccessException x) {
 106             throw new ServiceConfigurationError(null, x);
 107         } catch (InstantiationException x) {
 108             throw new ServiceConfigurationError(null, x);
 109         } catch (SecurityException x) {
 110             throw new ServiceConfigurationError(null, x);
 111         }
 112     }
 113 
 114     private static boolean loadProviderAsService() {
 115 
 116         ServiceLoader<SelectorProvider> sl =
 117             ServiceLoader.load(SelectorProvider.class,
 118                                ClassLoader.getSystemClassLoader());
 119         Iterator<SelectorProvider> i = sl.iterator();
 120         for (;;) {
 121             try {


< prev index next >