/** * Sends this message to the Debug channel (FINER level in JDK parlance) * * @param warningMessage The non-null message to log to the debug logger */ public void warning(String warningMessage, Throwable th) { jdkLogger.log(Level.WARNING, warningMessage, th); if (STDOUT_DEBUG) { System.out.println("HK2DEBUG (Warning): " + warningMessage); printThrowable(th); } }
private static ServiceLocatorGenerator getGenerator() { Iterable<? extends ServiceLocatorGenerator> generators = getOSGiSafeGenerators(); if (generators != null) { // non-null indicates we are in OSGi environment // So, we will return whatever we find. If we don't find anything here, then we assume it is a // configuration error and return null. // Since org.glassfish.hk2.osgiresourcelocator.ServiceLoader never throws ServiceConfigurationError, // there is no need to catch it and try next item in the iterator. final Iterator<? extends ServiceLocatorGenerator> iterator = generators.iterator(); return iterator.hasNext() ? iterator.next() : null; } // We are in non-OSGi environment, let's use JDK ServiceLoader instead. // Make sure we use our current loader to locate the service as opposed to some arbitrary TCL final ClassLoader classLoader = ServiceLocatorFactoryImpl.class.getClassLoader(); Iterator<ServiceLocatorGenerator> providers = java.util.ServiceLoader.load(ServiceLocatorGenerator.class, classLoader).iterator(); while (providers.hasNext()) { try { return providers.next(); } catch (ServiceConfigurationError sce) { // This can happen. See the exception javadoc for more details. Logger.getLogger().debug("ServiceLocatorFactoryImpl", "getGenerator", sce); // We will try the next one } } Logger.getLogger().warning("Cannot find a default implementation of the HK2 ServiceLocatorGenerator"); return null; }
private static ServiceLocatorGenerator getGenerator() { Iterable<? extends ServiceLocatorGenerator> generators = getOSGiSafeGenerators(); if (generators != null) { // non-null indicates we are in OSGi environment // So, we will return whatever we find. If we don't find anything here, then we assume it is a // configuration error and return null. // Since org.glassfish.hk2.osgiresourcelocator.ServiceLoader never throws ServiceConfigurationError, // there is no need to catch it and try next item in the iterator. final Iterator<? extends ServiceLocatorGenerator> iterator = generators.iterator(); return iterator.hasNext() ? iterator.next() : null; } // We are in non-OSGi environment, let's use JDK ServiceLoader instead. // Make sure we use our current loader to locate the service as opposed to some arbitrary TCL final ClassLoader classLoader = ServiceLocatorFactoryImpl.class.getClassLoader(); Iterator<ServiceLocatorGenerator> providers = java.util.ServiceLoader.load(ServiceLocatorGenerator.class, classLoader).iterator(); while (providers.hasNext()) { try { return providers.next(); } catch (ServiceConfigurationError sce) { // This can happen. See the exception javadoc for more details. Logger.getLogger().debug("ServiceLocatorFactoryImpl", "getGenerator", sce); // We will try the next one } } Logger.getLogger().warning("Cannot find a default implementation of the HK2 ServiceLocatorGenerator"); return null; }
/** * Sends this message to the Debug channel (FINER level in JDK parlance) * * @param debuggingMessage The non-null message to log to the debug logger */ public void debug(String debuggingMessage, Throwable th) { jdkLogger.log(Level.FINER, debuggingMessage, th); if (STDOUT_DEBUG) { System.out.println("HK2DEBUG: " + debuggingMessage); printThrowable(th); } }
private static ServiceLocatorGenerator getGenerator() { Iterable<? extends ServiceLocatorGenerator> generators = getOSGiSafeGenerators(); if (generators != null) { // non-null indicates we are in OSGi environment // So, we will return whatever we find. If we don't find anything here, then we assume it is a // configuration error and return null. // Since org.glassfish.hk2.osgiresourcelocator.ServiceLoader never throws ServiceConfigurationError, // there is no need to catch it and try next item in the iterator. final Iterator<? extends ServiceLocatorGenerator> iterator = generators.iterator(); return iterator.hasNext() ? iterator.next() : null; } // We are in non-OSGi environment, let's use JDK ServiceLoader instead. // Make sure we use our current loader to locate the service as opposed to some arbitrary TCL final ClassLoader classLoader = ServiceLocatorFactoryImpl.class.getClassLoader(); Iterator<ServiceLocatorGenerator> providers = java.util.ServiceLoader.load(ServiceLocatorGenerator.class, classLoader).iterator(); while (providers.hasNext()) { try { return providers.next(); } catch (ServiceConfigurationError sce) { // This can happen. See the exception javadoc for more details. Logger.getLogger().debug("ServiceLocatorFactoryImpl", "getGenerator", sce); // We will try the next one } } Logger.getLogger().warning("Cannot find a default implementation of the HK2 ServiceLocatorGenerator"); return null; }
/** * Sends this message to the Debug channel (FINER level in JDK parlance) * * @param warningMessage The non-null message to log to the debug logger */ public void warning(String warningMessage, Throwable th) { jdkLogger.log(Level.WARNING, warningMessage, th); if (STDOUT_DEBUG) { System.out.println("HK2DEBUG (Warning): " + warningMessage); printThrowable(th); } }
private static ServiceLocatorGenerator getGenerator() { Iterable<? extends ServiceLocatorGenerator> generators = getOSGiSafeGenerators(); if (generators != null) { // non-null indicates we are in OSGi environment // So, we will return whatever we find. If we don't find anything here, then we assume it is a // configuration error and return null. // Since org.glassfish.hk2.osgiresourcelocator.ServiceLoader never throws ServiceConfigurationError, // there is no need to catch it and try next item in the iterator. final Iterator<? extends ServiceLocatorGenerator> iterator = generators.iterator(); return iterator.hasNext() ? iterator.next() : null; } // We are in non-OSGi environment, let's use JDK ServiceLoader instead. // Make sure we use our current loader to locate the service as opposed to some arbitrary TCL final ClassLoader classLoader = ServiceLocatorFactoryImpl.class.getClassLoader(); Iterator<ServiceLocatorGenerator> providers = java.util.ServiceLoader.load(ServiceLocatorGenerator.class, classLoader).iterator(); while (providers.hasNext()) { try { return providers.next(); } catch (ServiceConfigurationError sce) { // This can happen. See the exception javadoc for more details. Logger.getLogger().debug("ServiceLocatorFactoryImpl", "getGenerator", sce); // We will try the next one } } Logger.getLogger().warning("Cannot find a default implementation of the HK2 ServiceLocatorGenerator"); return null; }
/** * Sends this message to the Debug channel (FINER level in JDK parlance) * * @param warningMessage The non-null message to log to the debug logger */ public void warning(String warningMessage, Throwable th) { jdkLogger.log(Level.WARNING, warningMessage, th); if (STDOUT_DEBUG) { System.out.println("HK2DEBUG (Warning): " + warningMessage); printThrowable(th); } }
/** * Sends this message to the Debug channel (FINER level in JDK parlance) * * @param debuggingMessage The non-null message to log to the debug logger */ public void debug(String debuggingMessage, Throwable th) { jdkLogger.log(Level.FINER, debuggingMessage, th); if (STDOUT_DEBUG) { System.out.println("HK2DEBUG: " + debuggingMessage); printThrowable(th); } }
/** * Sends this message to the Debug channel (FINER level in JDK parlance) * * @param debuggingMessage The non-null message to log to the debug logger */ public void debug(String debuggingMessage, Throwable th) { jdkLogger.log(Level.FINER, debuggingMessage, th); if (STDOUT_DEBUG) { System.out.println("HK2DEBUG: " + debuggingMessage); printThrowable(th); } }