当前位置: 首页>>代码示例>>Java>>正文


Java ServiceConfigurationError.printStackTrace方法代码示例

本文整理汇总了Java中java.util.ServiceConfigurationError.printStackTrace方法的典型用法代码示例。如果您正苦于以下问题:Java ServiceConfigurationError.printStackTrace方法的具体用法?Java ServiceConfigurationError.printStackTrace怎么用?Java ServiceConfigurationError.printStackTrace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.util.ServiceConfigurationError的用法示例。


在下文中一共展示了ServiceConfigurationError.printStackTrace方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getDatabase

import java.util.ServiceConfigurationError; //导入方法依赖的package包/类
/**
 * Iterate over all providers return the last provider.
 * 
 * @return
 */
public Database getDatabase() {
	Database database = null;
	//TODO fail when more than one provider was found?
	try {
		Iterator<Database> databaseProviders = loader.iterator();
		while (database == null && databaseProviders.hasNext()) {
			database = databaseProviders.next();
			log.debug("Found database service provider {" + database.getClass() + "}");
		}
	} catch (ServiceConfigurationError serviceError) {
		serviceError.printStackTrace();
	}
	if (database == null) {
		throw new RuntimeException("Could not find database provider.");
	}
	return database;
}
 
开发者ID:gentics,项目名称:mesh,代码行数:23,代码来源:DatabaseService.java

示例2: getStorage

import java.util.ServiceConfigurationError; //导入方法依赖的package包/类
/**
 * Iterate over all providers and return the last provider.
 * 
 * @return
 */
public BinaryStorage getStorage() {
	BinaryStorage binaryStorage = null;
	// TODO fail when more than one provider was found?
	try {
		Iterator<BinaryStorage> providers = loader.iterator();
		while (binaryStorage == null && providers.hasNext()) {
			binaryStorage = providers.next();
			log.debug("Found service provider {" + binaryStorage.getClass() + "}");
		}
	} catch (ServiceConfigurationError serviceError) {
		serviceError.printStackTrace();
	}
	if (binaryStorage == null) {
		throw new RuntimeException("Could not find image provider.");
	}
	return binaryStorage;
}
 
开发者ID:gentics,项目名称:mesh,代码行数:23,代码来源:BinaryStorageService.java

示例3: getImageProvider

import java.util.ServiceConfigurationError; //导入方法依赖的package包/类
/**
 * Iterate over all providers return the last provider.
 * 
 * @return
 */
public ImageManipulator getImageProvider() {
	ImageManipulator imageManipulator = null;
	//TODO fail when more than one provider was found?
	try {
		Iterator<ImageManipulator> providers = loader.iterator();
		while (imageManipulator == null && providers.hasNext()) {
			imageManipulator = providers.next();
			log.debug("Found service provider {" + imageManipulator.getClass() + "}");
		}
	} catch (ServiceConfigurationError serviceError) {
		serviceError.printStackTrace();
	}
	if (imageManipulator == null) {
		throw new RuntimeException("Could not find image provider.");
	}
	return imageManipulator;
}
 
开发者ID:gentics,项目名称:mesh,代码行数:23,代码来源:ImageManipulatorService.java

示例4: registerApplicationClasspathSpis

import java.util.ServiceConfigurationError; //导入方法依赖的package包/类
/**
 * Registers all available service providers found on the
 * application class path, using the default
 * <code>ClassLoader</code>.  This method is typically invoked by
 * the <code>ImageIO.scanForPlugins</code> method.
 *
 * @see javax.imageio.ImageIO#scanForPlugins
 * @see ClassLoader#getResources
 */
public void registerApplicationClasspathSpis() {
    // FIX: load only from application classpath

    ClassLoader loader = Thread.currentThread().getContextClassLoader();

    Iterator categories = getCategories();
    while (categories.hasNext()) {
        Class<IIOServiceProvider> c = (Class)categories.next();
        Iterator<IIOServiceProvider> riter =
                ServiceLoader.load(c, loader).iterator();
        while (riter.hasNext()) {
            try {
                // Note that the next() call is required to be inside
                // the try/catch block; see 6342404.
                IIOServiceProvider r = riter.next();
                registerServiceProvider(r);
            } catch (ServiceConfigurationError err) {
                if (System.getSecurityManager() != null) {
                    // In the applet case, we will catch the  error so
                    // registration of other plugins can  proceed
                    err.printStackTrace();
                } else {
                    // In the application case, we will  throw the
                    // error to indicate app/system  misconfiguration
                    throw err;
                }
            }
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:40,代码来源:IIORegistry.java

示例5: registerApplicationClasspathSpis

import java.util.ServiceConfigurationError; //导入方法依赖的package包/类
/**
 * Registers all available service providers found on the
 * application class path, using the default
 * {@code ClassLoader}.  This method is typically invoked by
 * the {@code ImageIO.scanForPlugins} method.
 *
 * @see javax.imageio.ImageIO#scanForPlugins
 * @see ClassLoader#getResources
 */
public void registerApplicationClasspathSpis() {
    // FIX: load only from application classpath

    ClassLoader loader = Thread.currentThread().getContextClassLoader();

    Iterator<Class<?>> categories = getCategories();
    while (categories.hasNext()) {
        @SuppressWarnings("unchecked")
        Class<IIOServiceProvider> c = (Class<IIOServiceProvider>)categories.next();
        Iterator<IIOServiceProvider> riter =
                ServiceLoader.load(c, loader).iterator();
        while (riter.hasNext()) {
            try {
                // Note that the next() call is required to be inside
                // the try/catch block; see 6342404.
                IIOServiceProvider r = riter.next();
                registerServiceProvider(r);
            } catch (ServiceConfigurationError err) {
                if (System.getSecurityManager() != null) {
                    // In the applet case, we will catch the  error so
                    // registration of other plugins can  proceed
                    err.printStackTrace();
                } else {
                    // In the application case, we will  throw the
                    // error to indicate app/system  misconfiguration
                    throw err;
                }
            }
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:41,代码来源:IIORegistry.java

示例6: getJdbcEventListener

import java.util.ServiceConfigurationError; //导入方法依赖的package包/类
@Override
public JdbcEventListener getJdbcEventListener() {
    // return first custom implementaion
    for (Iterator<LoggingEventListener> iterator = customLoggingEventListener.iterator(); iterator.hasNext(); ) {
        try {
            return iterator.next();
        } catch (ServiceConfigurationError e) {
            e.printStackTrace();
        }
    }
    // if none found, return default impl
    return LoggingEventListener.INSTANCE;
}
 
开发者ID:lodsve,项目名称:lodsve-framework,代码行数:14,代码来源:P6LogFactory.java

示例7: registerEventListenersFromServiceLoader

import java.util.ServiceConfigurationError; //导入方法依赖的package包/类
protected void registerEventListenersFromServiceLoader(CompoundJdbcEventListener compoundEventListener) {
    for (Iterator<JdbcEventListener> iterator = jdbcEventListenerServiceLoader.iterator(); iterator.hasNext(); ) {
        try {
            compoundEventListener.addListender(iterator.next());
        } catch (ServiceConfigurationError e) {
            e.printStackTrace();
        }
    }
}
 
开发者ID:lodsve,项目名称:lodsve-framework,代码行数:10,代码来源:DefaultJdbcEventListenerFactory.java

示例8: printCloudServices

import java.util.ServiceConfigurationError; //导入方法依赖的package包/类
public void printCloudServices() {
    try {
        Iterator<Cloud> providers = loader.iterator();
        while (providers.hasNext()) {
            Cloud c = providers.next();
            System.out.println("Provider Name: " + c.getProviderName());
            List<String> serviceNames = c.getServiceNames();
            for (String name : serviceNames) {
                System.out.println(name);
            }
        }
    } catch (ServiceConfigurationError e) {
        e.printStackTrace();
    }
}
 
开发者ID:msakamoto-sf,项目名称:JavaServiceProviderInterfaceDemo,代码行数:16,代码来源:CloudService.java

示例9: printSearchResults

import java.util.ServiceConfigurationError; //导入方法依赖的package包/类
public void printSearchResults(String keyword) {
    try {
        Iterator<Search> providers = loader.iterator();
        while (providers.hasNext()) {
            Search s = providers.next();
            System.out.println("Provider Name: " + s.getProviderName());
            List<String> searchResults = s.search(keyword);
            for (String result : searchResults) {
                System.out.println(result);
            }
        }
    } catch (ServiceConfigurationError e) {
        e.printStackTrace();
    }
}
 
开发者ID:msakamoto-sf,项目名称:JavaServiceProviderInterfaceDemo,代码行数:16,代码来源:SearchService.java


注:本文中的java.util.ServiceConfigurationError.printStackTrace方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。