org.wildfly.swarm.config.jca.LongRunningThreads Maven / Gradle / Ivy
package org.wildfly.swarm.config.jca;
import org.wildfly.config.runtime.Implicit;
import org.wildfly.config.runtime.ResourceType;
import org.wildfly.config.runtime.ModelNodeBinding;
import java.util.Map;
/**
* A thread pool executor with a bounded queue where threads submittings tasks will not block. Such a thread pool has a core and maximum size and a specified queue length. When a task is submitted, if the number of running threads is less than the core size, a new thread is created. Otherwise, if there is room in the queue, the task is enqueued. Otherwise, if the number of running threads is less than the maximum size, a new thread is created. Otherwise, the task is handed off to the designated handoff executor, if one is specified. Otherwise, the task is discarded.
*/
@ResourceType("long-running-threads")
public class LongRunningThreads {
private String key;
private Boolean allowCoreTimeout;
private Integer coreThreads;
private Integer currentThreadCount;
private String handoffExecutor;
private Map keepaliveTime;
private Integer largestThreadCount;
private Integer maxThreads;
private String name;
private Integer queueLength;
private Integer queueSize;
private Integer rejectedCount;
private String threadFactory;
public LongRunningThreads(String key) {
this.key = key;
}
public String getKey() {
return this.key;
}
/**
* Whether core threads may time out.
*/
@ModelNodeBinding(detypedName = "allow-core-timeout")
public Boolean allowCoreTimeout() {
return this.allowCoreTimeout;
}
/**
* Whether core threads may time out.
*/
@SuppressWarnings("unchecked")
public LongRunningThreads allowCoreTimeout(Boolean value) {
this.allowCoreTimeout = value;
return (LongRunningThreads) this;
}
/**
* The core thread pool size which is smaller than the maximum pool size. If undefined, the core thread pool size is the same as the maximum thread pool size.
*/
@ModelNodeBinding(detypedName = "core-threads")
public Integer coreThreads() {
return this.coreThreads;
}
/**
* The core thread pool size which is smaller than the maximum pool size. If undefined, the core thread pool size is the same as the maximum thread pool size.
*/
@SuppressWarnings("unchecked")
public LongRunningThreads coreThreads(Integer value) {
this.coreThreads = value;
return (LongRunningThreads) this;
}
/**
* The current number of threads in the pool.
*/
@ModelNodeBinding(detypedName = "current-thread-count")
public Integer currentThreadCount() {
return this.currentThreadCount;
}
/**
* The current number of threads in the pool.
*/
@SuppressWarnings("unchecked")
public LongRunningThreads currentThreadCount(Integer value) {
this.currentThreadCount = value;
return (LongRunningThreads) this;
}
/**
* An executor to delegate tasks to in the event that a task cannot be accepted. If not specified, tasks that cannot be accepted will be silently discarded.
*/
@ModelNodeBinding(detypedName = "handoff-executor")
public String handoffExecutor() {
return this.handoffExecutor;
}
/**
* An executor to delegate tasks to in the event that a task cannot be accepted. If not specified, tasks that cannot be accepted will be silently discarded.
*/
@SuppressWarnings("unchecked")
public LongRunningThreads handoffExecutor(String value) {
this.handoffExecutor = value;
return (LongRunningThreads) this;
}
/**
* Used to specify the amount of time that pool threads should be kept running when idle; if not specified, threads will run until the executor is shut down.
*/
@ModelNodeBinding(detypedName = "keepalive-time")
public Map keepaliveTime() {
return this.keepaliveTime;
}
/**
* Used to specify the amount of time that pool threads should be kept running when idle; if not specified, threads will run until the executor is shut down.
*/
@SuppressWarnings("unchecked")
public LongRunningThreads keepaliveTime(Map value) {
this.keepaliveTime = value;
return (LongRunningThreads) this;
}
/**
* The largest number of threads that have ever simultaneously been in the pool.
*/
@ModelNodeBinding(detypedName = "largest-thread-count")
public Integer largestThreadCount() {
return this.largestThreadCount;
}
/**
* The largest number of threads that have ever simultaneously been in the pool.
*/
@SuppressWarnings("unchecked")
public LongRunningThreads largestThreadCount(Integer value) {
this.largestThreadCount = value;
return (LongRunningThreads) this;
}
/**
* The maximum thread pool size.
*/
@ModelNodeBinding(detypedName = "max-threads")
public Integer maxThreads() {
return this.maxThreads;
}
/**
* The maximum thread pool size.
*/
@SuppressWarnings("unchecked")
public LongRunningThreads maxThreads(Integer value) {
this.maxThreads = value;
return (LongRunningThreads) this;
}
/**
* The name of the thread pool.
*/
@ModelNodeBinding(detypedName = "name")
public String name() {
return this.name;
}
/**
* The name of the thread pool.
*/
@SuppressWarnings("unchecked")
public LongRunningThreads name(String value) {
this.name = value;
return (LongRunningThreads) this;
}
/**
* The queue length.
*/
@ModelNodeBinding(detypedName = "queue-length")
public Integer queueLength() {
return this.queueLength;
}
/**
* The queue length.
*/
@SuppressWarnings("unchecked")
public LongRunningThreads queueLength(Integer value) {
this.queueLength = value;
return (LongRunningThreads) this;
}
/**
* The queue size.
*/
@ModelNodeBinding(detypedName = "queue-size")
public Integer queueSize() {
return this.queueSize;
}
/**
* The queue size.
*/
@SuppressWarnings("unchecked")
public LongRunningThreads queueSize(Integer value) {
this.queueSize = value;
return (LongRunningThreads) this;
}
/**
* The number of tasks that have been passed to the handoff-executor (if one is specified) or discarded.
*/
@ModelNodeBinding(detypedName = "rejected-count")
public Integer rejectedCount() {
return this.rejectedCount;
}
/**
* The number of tasks that have been passed to the handoff-executor (if one is specified) or discarded.
*/
@SuppressWarnings("unchecked")
public LongRunningThreads rejectedCount(Integer value) {
this.rejectedCount = value;
return (LongRunningThreads) this;
}
/**
* Specifies the name of a specific thread factory to use to create worker threads. If not defined an appropriate default thread factory will be used.
*/
@ModelNodeBinding(detypedName = "thread-factory")
public String threadFactory() {
return this.threadFactory;
}
/**
* Specifies the name of a specific thread factory to use to create worker threads. If not defined an appropriate default thread factory will be used.
*/
@SuppressWarnings("unchecked")
public LongRunningThreads threadFactory(String value) {
this.threadFactory = value;
return (LongRunningThreads) this;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy