/** * Override this method to creates a different kind of default executor service. This method is called when the system is * {@link #startService() started} without an executor service being {@link #setExecutorService(ExecutorService) set}. * <p> * This method creates a {@link Executors#newSingleThreadExecutor() single-threaded executor}. * </p> * * @return the executor service */ protected ExecutorService createDefaultExecutorService() { return Executors.newSingleThreadExecutor(new NamedThreadFactory("sequencing")); }
@Override public ExecutorService getCachedTreadPool( String name, int maxPoolSize ) { NamedThreadFactory threadFactory = new NamedThreadFactory(name); ExecutorService executorService = new ThreadPoolExecutor(0, maxPoolSize, 60L, TimeUnit.SECONDS, new SynchronousQueue<Runnable>(), threadFactory); return getOrCreateNewPool(name, executorService); }
@Override public ScheduledExecutorService getScheduledThreadPool( String name ) { return (ScheduledExecutorService)getOrCreateNewPool(name, Executors.newScheduledThreadPool(DEFAULT_SCHEDULED_THREAD_COUNT, new NamedThreadFactory(name))); }
@Override public ScheduledExecutorService getScheduledThreadPool( String name ) { return (ScheduledExecutorService)getOrCreateNewPool(name, Executors.newScheduledThreadPool(DEFAULT_SCHEDULED_THREAD_COUNT, new NamedThreadFactory(name))); }
@Override public ExecutorService getCachedTreadPool( String name, int maxPoolSize ) { NamedThreadFactory threadFactory = new NamedThreadFactory(name); ExecutorService executorService = new ThreadPoolExecutor(0, maxPoolSize, 60L, TimeUnit.SECONDS, new SynchronousQueue<Runnable>(), threadFactory); return getOrCreateNewPool(name, executorService); }
@Override public ScheduledExecutorService getScheduledThreadPool( String name ) { return (ScheduledExecutorService)getOrCreateNewPool(name, Executors.newScheduledThreadPool(DEFAULT_SCHEDULED_THREAD_COUNT, new NamedThreadFactory(name))); }
@Override public ExecutorService getCachedTreadPool( String name, int maxPoolSize ) { NamedThreadFactory threadFactory = new NamedThreadFactory(name); ExecutorService executorService = new ThreadPoolExecutor(0, maxPoolSize, 60L, TimeUnit.SECONDS, new SynchronousQueue<Runnable>(), threadFactory); return getOrCreateNewPool(name, executorService); }
@Override public ExecutorService getThreadPool( String name ) { return getOrCreateNewPool(name, Executors.newFixedThreadPool(DEFAULT_MAX_THREAD_COUNT, new NamedThreadFactory(name))); }
@Override public ExecutorService getThreadPool( String name ) { return getOrCreateNewPool(name, Executors.newFixedThreadPool(DEFAULT_MAX_THREAD_COUNT, new NamedThreadFactory(name))); }
@Override public ExecutorService getThreadPool( String name ) { return getOrCreateNewPool(name, Executors.newFixedThreadPool(DEFAULT_MAX_THREAD_COUNT, new NamedThreadFactory(name))); }
/** * Start this engine to make it available for use. This method does nothing if the engine is already running. * * @see #shutdown() */ public void start() { if (state == State.RUNNING) return; final Lock lock = this.lock.writeLock(); try { lock.lock(); this.state = State.STARTING; // Create an executor service that we'll use to start the repositories ... ThreadFactory threadFactory = new NamedThreadFactory("modeshape-start-repo"); repositoryStarterService = Executors.newCachedThreadPool(threadFactory); state = State.RUNNING; } catch (RuntimeException e) { state = State.NOT_RUNNING; throw e; } finally { lock.unlock(); } }
/** * Start this engine to make it available for use. This method does nothing if the engine is already running. * * @see #shutdown() */ public void start() { if (state == State.RUNNING) return; final Lock lock = this.lock.writeLock(); try { lock.lock(); this.state = State.STARTING; // Create an executor service that we'll use to start the repositories ... ThreadFactory threadFactory = new NamedThreadFactory("modeshape-start-repo"); repositoryStarterService = Executors.newCachedThreadPool(threadFactory); state = State.RUNNING; } catch (RuntimeException e) { state = State.NOT_RUNNING; throw e; } finally { lock.unlock(); } }
/** * Terminate all active sessions. * * @return a future representing the asynchronous session termination process. */ Future<Boolean> shutdown() { // Create a simple executor that will do the backgrounding for us ... final ExecutorService executor = Executors.newSingleThreadExecutor(new NamedThreadFactory("modeshape-repository-stop")); try { // Submit a runnable to terminate all sessions ... return executor.submit(() -> doShutdown(false)); } finally { // Now shutdown the executor and return the future ... executor.shutdown(); } }
/** * Terminate all active sessions. * * @return a future representing the asynchronous session termination process. */ Future<Boolean> shutdown() { // Create a simple executor that will do the backgrounding for us ... final ExecutorService executor = Executors.newSingleThreadExecutor(new NamedThreadFactory("modeshape-repository-stop")); try { // Submit a runnable to terminate all sessions ... return executor.submit(() -> doShutdown(false)); } finally { // Now shutdown the executor and return the future ... executor.shutdown(); } }
protected BackupActivity( File backupDirectory, LocalDocumentStore documentStore, BinaryStore binaryStore, RepositoryCache repositoryCache, BackupOptions options) { super(backupDirectory, documentStore, binaryStore, repositoryCache); CheckArg.isNotNull(options, "options"); CheckArg.isPositive(options.documentsPerFile(), "documentsPerFile"); this.options = options; this.changedDocumentQueue = new LinkedBlockingQueue<NodeKey>(); ThreadFactory threadFactory = new NamedThreadFactory("modeshape-backup"); this.changedDocumentWorker = Executors.newSingleThreadExecutor(threadFactory); this.observer = new BackupObserver(changedDocumentQueue); }
protected BackupActivity( File backupDirectory, LocalDocumentStore documentStore, BinaryStore binaryStore, RepositoryCache repositoryCache, BackupOptions options) { super(backupDirectory, documentStore, binaryStore, repositoryCache); CheckArg.isNotNull(options, "options"); CheckArg.isPositive(options.documentsPerFile(), "documentsPerFile"); this.options = options; this.changedDocumentQueue = new LinkedBlockingQueue<NodeKey>(); ThreadFactory threadFactory = new NamedThreadFactory("modeshape-backup"); this.changedDocumentWorker = Executors.newSingleThreadExecutor(threadFactory); this.observer = new BackupObserver(changedDocumentQueue); }
try { WatchService watchService = FileSystems.getDefault().newWatchService(); monitoringTask = Executors.newSingleThreadExecutor(new NamedThreadFactory("modeshape-fs-connector-monitor")) .submit(new MonitoringTask(watchService, this, Paths.get(directoryAbsolutePath))); } catch (UnsupportedOperationException e) {
ThreadFactory threadFactory = new NamedThreadFactory("load"); clientPool = Executors.newSingleThreadExecutor(threadFactory); } else {
try { WatchService watchService = FileSystems.getDefault().newWatchService(); monitoringTask = Executors.newSingleThreadExecutor(new NamedThreadFactory("modeshape-fs-connector-monitor")) .submit(new MonitoringTask(watchService, this, Paths.get(directoryAbsolutePath))); } catch (UnsupportedOperationException e) {
this.connectionFactory = connectionFactory; this.channel = new CompositeRequestChannel(this.sourceName, false, true); this.service = Executors.newSingleThreadExecutor(new NamedThreadFactory("search-" + sourceName));