List of usage examples for org.apache.solr.util DefaultSolrThreadFactory DefaultSolrThreadFactory
public DefaultSolrThreadFactory(String namePrefix)
From source file:org.vootoo.server.RequestExecutor.java
License:Apache License
public RequestExecutor(ExecutorConfig config) { this.config = config; requestExecutor = new ThreadPoolExecutor(config.getThreadNum(), config.getThreadNum(), config.getThreadKeepAliveMinute(), TimeUnit.MINUTES, new ArrayBlockingQueue<Runnable>(config.getMaxWaitTask()), new DefaultSolrThreadFactory(config.getName())); executorService = MoreExecutors.listeningDecorator(requestExecutor); }
From source file:uk.co.flax.biosolr.solr.ontology.SolrOntologyHelperFactory.java
License:Apache License
public OntologyHelper buildOntologyHelper() throws OntologyHelperException { return new OntologyHelperBuilder().ontologyUri(params.get(ONTOLOGY_URI_PARAM)) .labelPropertyUris(params.getParams(LABEL_PROPERTIES)) .synonymPropertyUris(params.getParams(SYNONYM_PROPERTIES)) .definitionPropertyUris(params.getParams(DEFINITION_PROPERTIES)) .ignorePropertyUris(params.getParams(IGNORE_PROPERTIES)).olsBaseUrl(params.get(OLS_BASE_URL)) .ontology(params.get(OLS_ONTOLOGY_NAME)) .pageSize(params.getInt(OLS_PAGE_SIZE, OLSOntologyHelper.PAGE_SIZE)) .threadpoolSize(params.getInt(OLS_THREADPOOL, OLSOntologyHelper.THREADPOOL_SIZE)) .threadFactory(new DefaultSolrThreadFactory("olsOntologyHelper")) .nodeLabelSeparator(/*from w w w . j a v a 2s. c om*/ params.get(NODE_LABEL_SEPARATOR_PARAM, OntologyHelperConfiguration.NODE_LABEL_SEPARATOR)) .nodePathSeparator( params.get(NODE_PATH_SEPARATOR_PARAM, OntologyHelperConfiguration.NODE_PATH_SEPARATOR)) .build(); }
From source file:uk.co.flax.biosolr.solr.update.processor.OntologyUpdateProcessorFactory.java
License:Apache License
private void initialiseOntologyCheckScheduler(SolrCore core) { executor = new ScheduledThreadPoolExecutor(1, new DefaultSolrThreadFactory("ontologyUpdate"), (Runnable r, ThreadPoolExecutor e) -> LOGGER.warn("Skipping execution of '{}' using '{}'", r, e)); executor.setExecuteExistingDelayedTasksAfterShutdownPolicy(false); executor.setContinueExistingPeriodicTasksAfterShutdownPolicy(false); // Add CloseHook to tidy up if core closes core.addCloseHook(new CloseHook() { @Override//from ww w . j a v a 2 s . c o m public void preClose(SolrCore core) { LOGGER.info("Triggering graceful shutdown of OntologyUpdate executor"); disposeHelper(); executor.shutdown(); } @Override public void postClose(SolrCore core) { if (executor.isTerminating()) { LOGGER.info("Forcing shutdown of OntologyUpdate executor"); executor.shutdownNow(); } } }); if (DELETE_CHECK_DELAY_MS > 0) { executor.scheduleAtFixedRate(new OntologyCheckRunnable(this), DELETE_CHECK_DELAY_MS, DELETE_CHECK_DELAY_MS, TimeUnit.MILLISECONDS); } }