sun.misc.Service Java Examples

The following examples show how to use sun.misc.Service. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ScriptEngineManager.java    From freehealth-connector with GNU Affero General Public License v3.0 6 votes vote down vote up
private void initEngines(ClassLoader loader) {
   Iterator itr = null;

   try {
      if (loader != null) {
         itr = Service.providers(ScriptEngineFactory.class, loader);
      } else {
         itr = Service.installedProviders(ScriptEngineFactory.class);
      }
   } catch (ServiceConfigurationError var4) {
      System.err.println("Can't find ScriptEngineFactory providers: " + var4.getMessage());
      if (DEBUG) {
         var4.printStackTrace();
      }

      return;
   }

   try {
      while(itr.hasNext()) {
         try {
            ScriptEngineFactory fact = (ScriptEngineFactory)itr.next();
            this.engineSpis.add(fact);
         } catch (ServiceConfigurationError var5) {
            System.err.println("ScriptEngineManager providers.next(): " + var5.getMessage());
            if (DEBUG) {
               var5.printStackTrace();
            }
         }
      }

   } catch (ServiceConfigurationError var6) {
      System.err.println("ScriptEngineManager providers.hasNext(): " + var6.getMessage());
      if (DEBUG) {
         var6.printStackTrace();
      }

   }
}
 
Example #2
Source File: InetAddress.java    From jdk-1.7-annotated with Apache License 2.0 6 votes vote down vote up
public NameService run() {
    Iterator itr = Service.providers(NameServiceDescriptor.class);
    while (itr.hasNext()) {
        NameServiceDescriptor nsd
            = (NameServiceDescriptor)itr.next();
        if (providerName.
            equalsIgnoreCase(nsd.getType()+","
                +nsd.getProviderName())) {
            try {
                return nsd.createNameService();
            } catch (Exception e) {
                e.printStackTrace();
                System.err.println(
                    "Cannot create name service:"
                     +providerName+": " + e);
            }
        }
    }

    return null;
}
 
Example #3
Source File: ScriptEngineManager.java    From freehealth-connector with GNU Affero General Public License v3.0 5 votes vote down vote up
private void initEngines(ClassLoader loader) {
   Iterator itr = null;

   try {
      if (loader != null) {
         itr = Service.providers(ScriptEngineFactory.class, loader);
      } else {
         itr = Service.installedProviders(ScriptEngineFactory.class);
      }
   } catch (ServiceConfigurationError var4) {
      System.err.println("Can't find ScriptEngineFactory providers: " + var4.getMessage());
      if (DEBUG) {
         var4.printStackTrace();
      }

      return;
   }

   try {
      while(itr.hasNext()) {
         try {
            ScriptEngineFactory fact = (ScriptEngineFactory)itr.next();
            this.engineSpis.add(fact);
         } catch (ServiceConfigurationError var5) {
            System.err.println("ScriptEngineManager providers.next(): " + var5.getMessage());
            if (DEBUG) {
               var5.printStackTrace();
            }
         }
      }

   } catch (ServiceConfigurationError var6) {
      System.err.println("ScriptEngineManager providers.hasNext(): " + var6.getMessage());
      if (DEBUG) {
         var6.printStackTrace();
      }

   }
}
 
Example #4
Source File: ScriptEngineManager.java    From freehealth-connector with GNU Affero General Public License v3.0 5 votes vote down vote up
private void initEngines(ClassLoader loader) {
   Iterator itr = null;

   try {
      if (loader != null) {
         itr = Service.providers(ScriptEngineFactory.class, loader);
      } else {
         itr = Service.installedProviders(ScriptEngineFactory.class);
      }
   } catch (ServiceConfigurationError var4) {
      System.err.println("Can't find ScriptEngineFactory providers: " + var4.getMessage());
      if (DEBUG) {
         var4.printStackTrace();
      }

      return;
   }

   try {
      while(itr.hasNext()) {
         try {
            ScriptEngineFactory fact = (ScriptEngineFactory)itr.next();
            this.engineSpis.add(fact);
         } catch (ServiceConfigurationError var5) {
            System.err.println("ScriptEngineManager providers.next(): " + var5.getMessage());
            if (DEBUG) {
               var5.printStackTrace();
            }
         }
      }

   } catch (ServiceConfigurationError var6) {
      System.err.println("ScriptEngineManager providers.hasNext(): " + var6.getMessage());
      if (DEBUG) {
         var6.printStackTrace();
      }

   }
}
 
Example #5
Source File: ScriptEngineManager.java    From freehealth-connector with GNU Affero General Public License v3.0 5 votes vote down vote up
private void initEngines(ClassLoader loader) {
   Iterator itr = null;

   try {
      if (loader != null) {
         itr = Service.providers(ScriptEngineFactory.class, loader);
      } else {
         itr = Service.installedProviders(ScriptEngineFactory.class);
      }
   } catch (ServiceConfigurationError var4) {
      System.err.println("Can't find ScriptEngineFactory providers: " + var4.getMessage());
      if (DEBUG.booleanValue()) {
         var4.printStackTrace();
      }

      return;
   }

   try {
      while(itr.hasNext()) {
         try {
            ScriptEngineFactory fact = (ScriptEngineFactory)itr.next();
            this.engineSpis.add(fact);
         } catch (ServiceConfigurationError var5) {
            System.err.println("ScriptEngineManager providers.next(): " + var5.getMessage());
            if (DEBUG.booleanValue()) {
               var5.printStackTrace();
            }
         }
      }

   } catch (ServiceConfigurationError var6) {
      System.err.println("ScriptEngineManager providers.hasNext(): " + var6.getMessage());
      if (DEBUG.booleanValue()) {
         var6.printStackTrace();
      }

   }
}
 
Example #6
Source File: Main.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public static void main() {
    // in jdk.unsupported
    Class<?> caller = Reflection.getCallerClass(2);

    // removed
    JPEGCodec r = new JPEGCodec();

    // removed
    SoftCache s = new SoftCache();

    // removed
    Service.providers(S.class);
}
 
Example #7
Source File: JdbcJarProvidersTest.java    From dekaf with Apache License 2.0 5 votes vote down vote up
@Test
public void check_federated_provider_service_is_published() {
  final Iterator providers = Service.providers(IntegralIntermediateFederatedProvider.class);

  boolean ok = providers.hasNext();
  assertThat(ok).isTrue();

  Object svc = providers.next();

  assertThat(svc).isInstanceOf(IntegralIntermediateFederatedProvider.class);
  assertThat(svc).isInstanceOf(JdbcIntermediateFederatedProvider.class);
}
 
Example #8
Source File: JdbcJarProvidersTest.java    From dekaf with Apache License 2.0 5 votes vote down vote up
@Test
public void check_unknown_database_provider_service_is_published() {
  final Iterator providers = Service.providers(IntegralIntermediateRdbmsProvider.class);

  boolean ok = providers.hasNext();
  assertThat(ok).isTrue();

  Object svc = providers.next();

  assertThat(svc).isInstanceOf(IntegralIntermediateRdbmsProvider.class);
  assertThat(svc).isInstanceOf(JdbcIntermediateRdbmsProvider.class);
}