public JiraHomeReplicatorService(final JiraHome jiraHome, final SecondaryJiraHome secondaryHome, final ApplicationProperties applicationProperties, final AttachmentPathManager attachmentPathManager, final AvatarManager avatarManager, final PluginPath pluginPath, final ClusterLockService clusterLockService, final SchedulerService schedulerService) { this(jiraHome, secondaryHome, applicationProperties, attachmentPathManager, avatarManager, pluginPath, clusterLockService, schedulerService, Executors.newFixedThreadPool(REPLICATOR_THREADS, ThreadFactories.namedThreadFactory("JiraHomeReplicatorService"))); }
@Override public Object getObject() throws Exception { return Executors.newFixedThreadPool(size, ThreadFactories.namedThreadFactory(name)); }
private static ListeningExecutorService defaultExecutor(String threadPoolName) { return MoreExecutors.listeningDecorator( java.util.concurrent.Executors.newCachedThreadPool( ThreadFactories.namedThreadFactory(threadPoolName) )); }
private ExecutorService newSingleThreadedBoundedExecutor() { return new ThreadPoolExecutor(1, 1, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>(EVENT_QUEUE_CAPACITY), ThreadFactories.namedThreadFactory("analyticsEventProcessor", ThreadFactories.Type.DAEMON), new RejectedExecutionHandler() { @Override public void rejectedExecution(Runnable r, ThreadPoolExecutor executor) { log.warn("Analytics event not be processed (most likely due to too many events in queue for single-threaded event processor)."); } }); }
private static ExecutorService newExecutorService() { return new ThreadPoolExecutor(0, Integer.MAX_VALUE, 10L, TimeUnit.SECONDS, new SynchronousQueue<Runnable>(), namedThreadFactory("long-running-task", USER)); }
/** * Create a new instance * @param settingsService Service used to get webhook settings * @param httpClientFactory Factory to generate HttpClients * @param securityService securityService * @param sshScmProtocol generates ssh clone URLs * @param httpScmProtocol generates http clone URLs */ public Notifier(SettingsService settingsService, HttpClientFactory httpClientFactory, SecurityService securityService, SshScmProtocol sshScmProtocol, HttpScmProtocol httpScmProtocol) { this.httpClientFactory = httpClientFactory; this.settingsService = settingsService; this.executorService = Executors.newCachedThreadPool(ThreadFactories.namedThreadFactory("JenkinsWebhook", ThreadFactories.Type.DAEMON)); this.securityService = securityService; this.scmProtocol = sshScmProtocol; this.httpScmProtocol = httpScmProtocol; }
private ExecutorService createBoundedExecutorService() { return new ThreadPoolExecutor(threadPoolSize, threadPoolSize, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>(queueSize), namedThreadFactory("hipchat-client", DAEMON), // RejectedExecutionHandler implementation that suppresses the exception that // would be thrown in case of a task being rejected and logs a WARN message instead. new RejectedExecutionHandler() { @Override public void rejectedExecution(Runnable task, ThreadPoolExecutor executor) { log.debug("Task '{}' rejected from thread pool executor '{}'.", task.toString(), executor.toString()); } }); }
final ExecutorService pool = Executors.newSingleThreadExecutor(ThreadFactories.namedThreadFactory("Modification Check", ThreadFactories.Type.DAEMON)); pool.execute(new ModificationCheck(logMsg));
.setThreadFactory(ThreadFactories.namedThreadFactory(options.getThreadPrefix() + "-io", ThreadFactories.Type.DAEMON)) .setDefaultIOReactorConfig(reactorConfig) .setConnectionManager(connectionManager)
DefaultConnectingIOReactor reactor = new DefaultConnectingIOReactor( ioReactorConfig, ThreadFactories.namedThreadFactory(options.getThreadPrefix() + "-io", ThreadFactories.Type.DAEMON)); reactor.setExceptionHandler(new IOReactorExceptionHandler()