/** sets the executor service used for scanning to ThreadPoolExecutor with core size as the given availableProcessors parameter. * the executor service spawns daemon threads by default. * <p>default is ThreadPoolExecutor with a single core */ public ConfigurationBuilder useParallelExecutor(final int availableProcessors) { ThreadFactory factory = new ThreadFactoryBuilder().setDaemon(true).setNameFormat("org.reflections-scanner-%d").build(); setExecutorService(Executors.newFixedThreadPool(availableProcessors, factory)); return this; }
/** sets the executor service used for scanning to ThreadPoolExecutor with core size as the given availableProcessors parameter. * the executor service spawns daemon threads by default. * <p>default is ThreadPoolExecutor with a single core */ public ConfigurationBuilder useParallelExecutor(final int availableProcessors) { ThreadFactory factory = new ThreadFactoryBuilder().setDaemon(true).setNameFormat("org.reflections-scanner-%d").build(); setExecutorService(Executors.newFixedThreadPool(availableProcessors, factory)); return this; }
else if (param instanceof ClassLoader) { /* already taken care */ } else if (param instanceof Predicate) { filter.add((Predicate<String>) param); } else if (param instanceof ExecutorService) { builder.setExecutorService((ExecutorService) param); } else if (Reflections.log != null) { throw new ReflectionsException("could not use param " + param); }
else if (param instanceof ClassLoader) { /* already taken care */ } else if (param instanceof Predicate) { filter.add((Predicate<String>) param); } else if (param instanceof ExecutorService) { builder.setExecutorService((ExecutorService) param); } else if (Reflections.log != null) { throw new ReflectionsException("could not use param " + param); }
/** sets the executor service used for scanning to ThreadPoolExecutor with core size as the given availableProcessors parameter * <p>default is ThreadPoolExecutor with a single core */ public ConfigurationBuilder useParallelExecutor(final int availableProcessors) { setExecutorService(Executors.newFixedThreadPool(availableProcessors)); return this; }
/** sets the executor service used for scanning to ThreadPoolExecutor with core size as the given availableProcessors parameter. * the executor service spawns daemon threads by default. * <p>default is ThreadPoolExecutor with a single core */ public ConfigurationBuilder useParallelExecutor(final int availableProcessors) { ThreadFactory factory = new ThreadFactoryBuilder().setDaemon(true).setNameFormat("org.reflections-scanner-%d").build(); setExecutorService(Executors.newFixedThreadPool(availableProcessors, factory)); return this; }
public ReflectionsClassCollectStrategy(Set<URL> urls) { super(urls); ClassLoader classLoader = asClassloader(urls); // Set the context ClassLoader for this Thread to include all classes. // if we don't do this Reflections gets confused and fetches only a subset // of components. probably because duplicate entries of Component.class? Thread.currentThread().setContextClassLoader(classLoader); reflections = new Reflections(new ConfigurationBuilder() .setUrls(urls) .setScanners(new SubTypesScanner(true)) .setExecutorService(Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors())) ); }
public ReflectionsClassCollectStrategy(Set<URL> urls) { super(urls); ClassLoader classLoader = asClassloader(urls); // Set the context ClassLoader for this Thread to include all classes. // if we don't do this Reflections gets confused and fetches only a subset // of components. probably because duplicate entries of Component.class? Thread.currentThread().setContextClassLoader(classLoader); reflections = new Reflections(new ConfigurationBuilder() .setUrls(urls) .setScanners(new SubTypesScanner(true)) .setExecutorService(Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors())) ); }
public ConfigurationBuilder useParallelExecutor(final int availableProcessors) { ThreadFactory factory = new ThreadFactoryBuilder().setDaemon(true).setNameFormat("org.reflections-scanner-%d").build(); setExecutorService(Executors.newFixedThreadPool(availableProcessors , factory)); return this; }
protected Reflections loadApiReflections(List<URL> classpath) { ConfigurationBuilder reflectionSpec = new ConfigurationBuilder() .setUrls(classpath) .setScanners(new EnunciateReflectionsScanner(this, getModules())); if (this.executorService != null) { reflectionSpec = reflectionSpec.setExecutorService(this.executorService); } return new Reflections(reflectionSpec); }
protected Reflections loadApiReflections(List<URL> classpath) { ConfigurationBuilder reflectionSpec = new ConfigurationBuilder() .setUrls(classpath) .setScanners(new EnunciateReflectionsScanner(this, getModules())); if (this.executorService != null) { reflectionSpec = reflectionSpec.setExecutorService(this.executorService); } return new Reflections(reflectionSpec); }
else if (param instanceof ClassLoader) { /* already taken care */ } else if (param instanceof Predicate) { filter.add((Predicate<String>) param); } else if (param instanceof ExecutorService) { builder.setExecutorService((ExecutorService) param); } else if (Reflections.log != null) { throw new ReflectionsException("could not use param " + param); }
filter.add((Predicate<String>) param); } else if (param instanceof ExecutorService) { builder.setExecutorService((ExecutorService) param); } else { throw new ReflectionsException("could not use param " + param);
else if (param instanceof ClassLoader) { /* already taken care */ } else if (param instanceof Predicate) { filter.add((Predicate<String>) param); } else if (param instanceof ExecutorService) { builder.setExecutorService((ExecutorService) param); } else if (Reflections.log != null) { throw new ReflectionsException("could not use param " + param); }