Java Code Examples for java.util.concurrent.ScheduledThreadPoolExecutor#getCorePoolSize()

The following examples show how to use java.util.concurrent.ScheduledThreadPoolExecutor#getCorePoolSize() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ThreadPoolReSeter.java    From sumk with Apache License 2.0 5 votes vote down vote up
private void resetScheduledThreadPoolSize() {
	int size = AppInfo.getInt("sumk.core.schedule.thread", 0);
	ScheduledThreadPoolExecutor schedule = SumkThreadPool.scheduledExecutor();
	if (size > 0 && schedule.getCorePoolSize() != size) {
		logger.info("change Schedule ThreadPool size from {} to {}", schedule.getCorePoolSize(), size);
		schedule.setCorePoolSize(size);
	}
}
 
Example 2
Source File: LazyTraceThreadPoolTaskScheduler.java    From spring-cloud-sleuth with Apache License 2.0 5 votes vote down vote up
@Override
public ScheduledThreadPoolExecutor getScheduledThreadPoolExecutor()
		throws IllegalStateException {
	ScheduledThreadPoolExecutor executor = this.delegate
			.getScheduledThreadPoolExecutor();
	if (executor instanceof LazyTraceScheduledThreadPoolExecutor) {
		return executor;
	}
	return new LazyTraceScheduledThreadPoolExecutor(executor.getCorePoolSize(),
			executor.getThreadFactory(), executor.getRejectedExecutionHandler(),
			this.beanFactory, executor);
}
 
Example 3
Source File: ExecutorBeanPostProcessor.java    From elasticactors with Apache License 2.0 5 votes vote down vote up
Supplier<Executor> createScheduledThreadPoolExecutorProxy(
        ScheduledThreadPoolExecutor executor) {
    return () -> new LazyTraceScheduledThreadPoolExecutor(
            executor.getCorePoolSize(),
            executor.getThreadFactory(),
            executor.getRejectedExecutionHandler(),
            executor);
}
 
Example 4
Source File: LazyTraceThreadPoolTaskScheduler.java    From elasticactors with Apache License 2.0 5 votes vote down vote up
@Override
public ScheduledThreadPoolExecutor getScheduledThreadPoolExecutor()
        throws IllegalStateException {
    ScheduledThreadPoolExecutor executor = this.delegate.getScheduledThreadPoolExecutor();
    if (executor instanceof LazyTraceScheduledThreadPoolExecutor) {
        return executor;
    }
    return new LazyTraceScheduledThreadPoolExecutor(
            executor.getCorePoolSize(),
            executor.getThreadFactory(),
            executor.getRejectedExecutionHandler(),
            executor);
}
 
Example 5
Source File: ExecutorBeanPostProcessor.java    From spring-cloud-sleuth with Apache License 2.0 4 votes vote down vote up
Supplier<Executor> createScheduledThreadPoolExecutorProxy(
		ScheduledThreadPoolExecutor executor) {
	return () -> new LazyTraceScheduledThreadPoolExecutor(executor.getCorePoolSize(),
			executor.getThreadFactory(), executor.getRejectedExecutionHandler(),
			this.beanFactory, executor);
}