parent
55961544a7
commit
77298a19c9
|
@ -63,8 +63,8 @@ public abstract class ExecutorConfigurationSupport extends CustomizableThreadFac
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the ThreadFactory to use for the ThreadPoolExecutor's thread pool.
|
* Set the ThreadFactory to use for the ExecutorService's thread pool.
|
||||||
* Default is the ThreadPoolExecutor's default thread factory.
|
* Default is the underlying ExecutorService's default thread factory.
|
||||||
* @see java.util.concurrent.Executors#defaultThreadFactory()
|
* @see java.util.concurrent.Executors#defaultThreadFactory()
|
||||||
*/
|
*/
|
||||||
public void setThreadFactory(ThreadFactory threadFactory) {
|
public void setThreadFactory(ThreadFactory threadFactory) {
|
||||||
|
@ -78,8 +78,8 @@ public abstract class ExecutorConfigurationSupport extends CustomizableThreadFac
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the RejectedExecutionHandler to use for the ThreadPoolExecutor.
|
* Set the RejectedExecutionHandler to use for the ExecutorService.
|
||||||
* Default is the ThreadPoolExecutor's default abort policy.
|
* Default is the ExecutorService's default abort policy.
|
||||||
* @see java.util.concurrent.ThreadPoolExecutor.AbortPolicy
|
* @see java.util.concurrent.ThreadPoolExecutor.AbortPolicy
|
||||||
*/
|
*/
|
||||||
public void setRejectedExecutionHandler(RejectedExecutionHandler rejectedExecutionHandler) {
|
public void setRejectedExecutionHandler(RejectedExecutionHandler rejectedExecutionHandler) {
|
||||||
|
@ -181,7 +181,7 @@ public abstract class ExecutorConfigurationSupport extends CustomizableThreadFac
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Perform a shutdown on the ThreadPoolExecutor.
|
* Perform a shutdown on the underlying ExecutorService.
|
||||||
* @see java.util.concurrent.ExecutorService#shutdown()
|
* @see java.util.concurrent.ExecutorService#shutdown()
|
||||||
* @see java.util.concurrent.ExecutorService#shutdownNow()
|
* @see java.util.concurrent.ExecutorService#shutdownNow()
|
||||||
* @see #awaitTerminationIfNecessary()
|
* @see #awaitTerminationIfNecessary()
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2012 the original author or authors.
|
* Copyright 2002-2013 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -37,9 +37,10 @@ import org.springframework.util.ObjectUtils;
|
||||||
*
|
*
|
||||||
* <p>Allows for registration of {@link ScheduledExecutorTask ScheduledExecutorTasks},
|
* <p>Allows for registration of {@link ScheduledExecutorTask ScheduledExecutorTasks},
|
||||||
* automatically starting the {@link ScheduledExecutorService} on initialization and
|
* automatically starting the {@link ScheduledExecutorService} on initialization and
|
||||||
* cancelling it on destruction of the context. In scenarios that just require static
|
* cancelling it on destruction of the context. In scenarios that only require static
|
||||||
* registration of tasks at startup, there is no need to access the
|
* registration of tasks at startup, there is no need to access the
|
||||||
* {@link ScheduledExecutorService} instance itself in application code.
|
* {@link ScheduledExecutorService} instance itself in application code at all;
|
||||||
|
* ScheduledExecutorFactoryBean is then just being used for lifecycle integration.
|
||||||
*
|
*
|
||||||
* <p>Note that {@link java.util.concurrent.ScheduledExecutorService}
|
* <p>Note that {@link java.util.concurrent.ScheduledExecutorService}
|
||||||
* uses a {@link Runnable} instance that is shared between repeated executions,
|
* uses a {@link Runnable} instance that is shared between repeated executions,
|
||||||
|
@ -92,7 +93,7 @@ public class ScheduledExecutorFactoryBean extends ExecutorConfigurationSupport
|
||||||
* @see java.util.concurrent.ScheduledExecutorService#scheduleWithFixedDelay(java.lang.Runnable, long, long, java.util.concurrent.TimeUnit)
|
* @see java.util.concurrent.ScheduledExecutorService#scheduleWithFixedDelay(java.lang.Runnable, long, long, java.util.concurrent.TimeUnit)
|
||||||
* @see java.util.concurrent.ScheduledExecutorService#scheduleAtFixedRate(java.lang.Runnable, long, long, java.util.concurrent.TimeUnit)
|
* @see java.util.concurrent.ScheduledExecutorService#scheduleAtFixedRate(java.lang.Runnable, long, long, java.util.concurrent.TimeUnit)
|
||||||
*/
|
*/
|
||||||
public void setScheduledExecutorTasks(ScheduledExecutorTask[] scheduledExecutorTasks) {
|
public void setScheduledExecutorTasks(ScheduledExecutorTask... scheduledExecutorTasks) {
|
||||||
this.scheduledExecutorTasks = scheduledExecutorTasks;
|
this.scheduledExecutorTasks = scheduledExecutorTasks;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -192,9 +193,9 @@ public class ScheduledExecutorFactoryBean extends ExecutorConfigurationSupport
|
||||||
* @return the actual Runnable to schedule (may be a decorator)
|
* @return the actual Runnable to schedule (may be a decorator)
|
||||||
*/
|
*/
|
||||||
protected Runnable getRunnableToSchedule(ScheduledExecutorTask task) {
|
protected Runnable getRunnableToSchedule(ScheduledExecutorTask task) {
|
||||||
return this.continueScheduledExecutionAfterException
|
return (this.continueScheduledExecutionAfterException ?
|
||||||
? new DelegatingErrorHandlingRunnable(task.getRunnable(), TaskUtils.LOG_AND_SUPPRESS_ERROR_HANDLER)
|
new DelegatingErrorHandlingRunnable(task.getRunnable(), TaskUtils.LOG_AND_SUPPRESS_ERROR_HANDLER) :
|
||||||
: new DelegatingErrorHandlingRunnable(task.getRunnable(), TaskUtils.LOG_AND_PROPAGATE_ERROR_HANDLER);
|
new DelegatingErrorHandlingRunnable(task.getRunnable(), TaskUtils.LOG_AND_PROPAGATE_ERROR_HANDLER));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,6 @@ public class ThreadPoolExecutorFactoryBean extends ExecutorConfigurationSupport
|
||||||
/**
|
/**
|
||||||
* Set the ThreadPoolExecutor's core pool size.
|
* Set the ThreadPoolExecutor's core pool size.
|
||||||
* Default is 1.
|
* Default is 1.
|
||||||
* <p><b>This setting can be modified at runtime, for example through JMX.</b>
|
|
||||||
*/
|
*/
|
||||||
public void setCorePoolSize(int corePoolSize) {
|
public void setCorePoolSize(int corePoolSize) {
|
||||||
this.corePoolSize = corePoolSize;
|
this.corePoolSize = corePoolSize;
|
||||||
|
@ -80,7 +79,6 @@ public class ThreadPoolExecutorFactoryBean extends ExecutorConfigurationSupport
|
||||||
/**
|
/**
|
||||||
* Set the ThreadPoolExecutor's maximum pool size.
|
* Set the ThreadPoolExecutor's maximum pool size.
|
||||||
* Default is {@code Integer.MAX_VALUE}.
|
* Default is {@code Integer.MAX_VALUE}.
|
||||||
* <p><b>This setting can be modified at runtime, for example through JMX.</b>
|
|
||||||
*/
|
*/
|
||||||
public void setMaxPoolSize(int maxPoolSize) {
|
public void setMaxPoolSize(int maxPoolSize) {
|
||||||
this.maxPoolSize = maxPoolSize;
|
this.maxPoolSize = maxPoolSize;
|
||||||
|
@ -89,7 +87,6 @@ public class ThreadPoolExecutorFactoryBean extends ExecutorConfigurationSupport
|
||||||
/**
|
/**
|
||||||
* Set the ThreadPoolExecutor's keep-alive seconds.
|
* Set the ThreadPoolExecutor's keep-alive seconds.
|
||||||
* Default is 60.
|
* Default is 60.
|
||||||
* <p><b>This setting can be modified at runtime, for example through JMX.</b>
|
|
||||||
*/
|
*/
|
||||||
public void setKeepAliveSeconds(int keepAliveSeconds) {
|
public void setKeepAliveSeconds(int keepAliveSeconds) {
|
||||||
this.keepAliveSeconds = keepAliveSeconds;
|
this.keepAliveSeconds = keepAliveSeconds;
|
||||||
|
|
Loading…
Reference in New Issue