本文整理了Java中java.util.ServiceLoader.reload()
方法的一些代码示例,展示了ServiceLoader.reload()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ServiceLoader.reload()
方法的具体详情如下:
包路径:java.util.ServiceLoader
类名称:ServiceLoader
方法名:reload
[英]Invalidates the cache of known service provider class names.
[中]使已知服务提供程序类名的缓存无效。
代码示例来源:origin: ninjaframework/ninja
public void reload() {
this.serviceLoader.reload();
}
代码示例来源:origin: hibernate/hibernate-orm
@Override
public void stop() {
for ( ServiceLoader serviceLoader : serviceLoaders.values() ) {
serviceLoader.reload(); // clear service loader providers
}
serviceLoaders.clear();
//Avoid ClassLoader leaks
this.aggregatedClassLoader = null;
}
代码示例来源:origin: robovm/robovm
private ServiceLoader(Class<S> service, ClassLoader classLoader) {
// It makes no sense for service to be null.
// classLoader is null if you want the system class loader.
if (service == null) {
throw new NullPointerException("service == null");
}
this.service = service;
this.classLoader = classLoader;
this.services = new HashSet<URL>();
reload();
}
代码示例来源:origin: apache/geode
ServiceLoader<CommandMarker> loader =
ServiceLoader.load(CommandMarker.class, ClassPathLoader.getLatest().asClassLoader());
loader.reload();
Iterator<CommandMarker> iterator = loader.iterator();
代码示例来源:origin: geotools/geotools
private static <T> List<T> initFactories(Class<T> type) {
ServiceLoader<T> loader = ServiceLoader.load(type);
loader.reload();
List<T> factories = new ArrayList<>();
for (T aLoader : loader) {
factories.add(aLoader);
}
return factories;
}
代码示例来源:origin: geotools/geotools
/**
* Helper method that loads all the custom data stores extensions.
*
* @return the list of found custom data store extensions
*/
static List<CustomSourceDataStore> loadExtensions() {
ServiceLoader<CustomSourceDataStore> loader =
ServiceLoader.load(CustomSourceDataStore.class);
loader.reload();
// get the custom data store extensions from the loader
List<CustomSourceDataStore> extensions = new ArrayList<>();
for (CustomSourceDataStore extension : loader) {
extensions.add(extension);
}
return extensions;
}
}
代码示例来源:origin: net.sf.ehcache/ehcache
/**
* Tries to find a SizeOfEngineFactory instance that is assignable from clazz
*
* @param clazz the class
* @param reload whether to force a reload of the ServiceLoader
* @return true if succeeded otherwise, false
*/
public synchronized boolean load(Class<? extends SizeOfEngineFactory> clazz, boolean reload) {
if (reload) {
loader.reload();
}
for (SizeOfEngineFactory sizeOfEngineFactory : loader) {
if (clazz.isAssignableFrom(sizeOfEngineFactory.getClass())) {
factory = sizeOfEngineFactory;
return true;
}
}
factory = null;
return false;
}
}
代码示例来源:origin: Teradata/kylo
serviceLoader.reload();
configLoaded.addAll(resources);
return log.exit(true);
代码示例来源:origin: apache/accumulo
extensions.reload();
} else if (cl.hasOption(list.getOpt())) {
shellState.printLines(loadedExtensions.iterator(), true);
代码示例来源:origin: apache/tinkerpop
final ServiceLoader<KryoShimService> serviceLoader = ServiceLoader.load(KryoShimService.class);
synchronized (KryoShimServiceLoader.class) {
if (forceReload) serviceLoader.reload();
for (final KryoShimService kss : serviceLoader) {
services.add(kss);
代码示例来源:origin: dcm4che/dcm4che
public static void reload() {
synchronized (loader) {
loader.reload();
}
}
代码示例来源:origin: com.github.muff1nman.chameleon/core
/**
* Refreshes the list of providers managed by this factory.
* If new providers are added after the instantiation of this factory, you will need to call this method manually.
*/
public void reloadProviders()
{
_serviceLoader.reload();
}
代码示例来源:origin: org.pageseeder.ox/pso-ox-core
/**
* reload the Service Loader.
*/
public void reload() {
this.loader.reload();
}
代码示例来源:origin: com.github.muff1nman.chameleon/core
/**
* Refreshes the list of providers managed by this center.
* If new providers are added after the instantiation of this class, you will need to call this method manually.
*/
public void reloadProviders()
{
_serviceLoader.reload();
}
代码示例来源:origin: ibinti/bugvm
private ServiceLoader(Class<S> service, ClassLoader classLoader) {
// It makes no sense for service to be null.
// classLoader is null if you want the system class loader.
if (service == null) {
throw new NullPointerException("service == null");
}
this.service = service;
this.classLoader = classLoader;
this.services = new HashSet<URL>();
reload();
}
代码示例来源:origin: com.bugvm/bugvm-rt
private ServiceLoader(Class<S> service, ClassLoader classLoader) {
// It makes no sense for service to be null.
// classLoader is null if you want the system class loader.
if (service == null) {
throw new NullPointerException("service == null");
}
this.service = service;
this.classLoader = classLoader;
this.services = new HashSet<URL>();
reload();
}
代码示例来源:origin: org.hibernate.orm/hibernate-core
@Override
public void stop() {
for ( ServiceLoader serviceLoader : serviceLoaders.values() ) {
serviceLoader.reload(); // clear service loader providers
}
serviceLoaders.clear();
//Avoid ClassLoader leaks
this.aggregatedClassLoader = null;
}
代码示例来源:origin: com.mobidevelop.robovm/robovm-rt
private ServiceLoader(Class<S> service, ClassLoader classLoader) {
// It makes no sense for service to be null.
// classLoader is null if you want the system class loader.
if (service == null) {
throw new NullPointerException("service == null");
}
this.service = service;
this.classLoader = classLoader;
this.services = new HashSet<URL>();
reload();
}
代码示例来源:origin: ai.h2o/h2o-genmodel
private ModelMojoReader loadMojoReader(String algo) {
assert algo != null : "Name of algorithm should be != null!";
synchronized (loader) {
loader.reload();
for (ModelMojoReader mrb : loader) {
if (algo.equals(mrb.getModelName())) {
return mrb;
}
}
}
return null;
}
代码示例来源:origin: neo4j/neo4j-ogm
private Function<String, String> loadCypherModifications() {
Map<String, Object> configurationProperties = this.customPropertiesSupplier.get();
this.cypherModificationProviderLoader.reload();
return StreamSupport.stream(this.cypherModificationProviderLoader.spliterator(), false)
.sorted(Comparator.comparing(CypherModificationProvider::getOrder))
.map(provider -> provider.getCypherModification(configurationProperties))
.reduce(Function.identity(), Function::andThen, Function::andThen);
}
}
内容来源于网络,如有侵权,请联系作者删除!