All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.wildfly.swarm.config.ee.ManagedScheduledExecutorService Maven / Gradle / Ivy

The newest version!
package org.wildfly.swarm.config.ee;

import org.wildfly.swarm.config.runtime.AttributeDocumentation;
import org.wildfly.swarm.config.runtime.ResourceDocumentation;
import org.wildfly.swarm.config.runtime.SingletonResource;
import org.wildfly.swarm.config.runtime.Address;
import org.wildfly.swarm.config.runtime.ResourceType;
import java.beans.PropertyChangeSupport;
import java.beans.PropertyChangeListener;
import org.wildfly.swarm.config.runtime.ModelNodeBinding;
import java.util.Arrays;
import org.wildfly.swarm.config.ee.RejectPolicy;

/**
 * A managed scheduled executor service
 */
@Address("/subsystem=ee/managed-scheduled-executor-service=*")
@ResourceType("managed-scheduled-executor-service")
public class ManagedScheduledExecutorService>
		implements
			org.wildfly.swarm.config.runtime.Keyed {

	private String key;
	private PropertyChangeSupport pcs;
	@AttributeDocumentation("The name of the context service to be used by the scheduled executor.")
	private String contextService;
	@AttributeDocumentation("The minimum number of threads to be used by the scheduled executor.")
	private Integer coreThreads;
	@AttributeDocumentation("The runtime, in milliseconds, for tasks to be considered hung by the scheduled executor. If 0 tasks are never considered hung.")
	private Long hungTaskThreshold;
	@AttributeDocumentation("The JNDI Name to lookup the managed scheduled executor service.")
	private String jndiName;
	@AttributeDocumentation("When the number of threads is greater than the core, this is the maximum time, in milliseconds, that excess idle threads will wait for new tasks before terminating.")
	private Long keepaliveTime;
	@AttributeDocumentation("Flag which hints the duration of tasks executed by the scheduled executor.")
	private Boolean longRunningTasks;
	@AttributeDocumentation("The policy to be applied to aborted tasks.")
	private RejectPolicy rejectPolicy;
	@AttributeDocumentation("The name of the thread factory to be used by the scheduled executor.")
	private String threadFactory;

	public ManagedScheduledExecutorService(java.lang.String key) {
		super();
		this.key = key;
	}

	public String getKey() {
		return this.key;
	}

	/**
	 * Adds a property change listener
	 */
	public void addPropertyChangeListener(PropertyChangeListener listener) {
		if (null == this.pcs)
			this.pcs = new PropertyChangeSupport(this);
		this.pcs.addPropertyChangeListener(listener);
	}

	/**
	 * Removes a property change listener
	 */
	public void removePropertyChangeListener(
			java.beans.PropertyChangeListener listener) {
		if (this.pcs != null)
			this.pcs.removePropertyChangeListener(listener);
	}

	/**
	 * The name of the context service to be used by the scheduled executor.
	 */
	@ModelNodeBinding(detypedName = "context-service")
	public String contextService() {
		return this.contextService;
	}

	/**
	 * The name of the context service to be used by the scheduled executor.
	 */
	@SuppressWarnings("unchecked")
	public T contextService(java.lang.String value) {
		Object oldValue = this.contextService;
		this.contextService = value;
		if (this.pcs != null)
			this.pcs.firePropertyChange("contextService", oldValue, value);
		return (T) this;
	}

	/**
	 * The minimum number of threads to be used by the scheduled executor.
	 */
	@ModelNodeBinding(detypedName = "core-threads")
	public Integer coreThreads() {
		return this.coreThreads;
	}

	/**
	 * The minimum number of threads to be used by the scheduled executor.
	 */
	@SuppressWarnings("unchecked")
	public T coreThreads(java.lang.Integer value) {
		Object oldValue = this.coreThreads;
		this.coreThreads = value;
		if (this.pcs != null)
			this.pcs.firePropertyChange("coreThreads", oldValue, value);
		return (T) this;
	}

	/**
	 * The runtime, in milliseconds, for tasks to be considered hung by the
	 * scheduled executor. If 0 tasks are never considered hung.
	 */
	@ModelNodeBinding(detypedName = "hung-task-threshold")
	public Long hungTaskThreshold() {
		return this.hungTaskThreshold;
	}

	/**
	 * The runtime, in milliseconds, for tasks to be considered hung by the
	 * scheduled executor. If 0 tasks are never considered hung.
	 */
	@SuppressWarnings("unchecked")
	public T hungTaskThreshold(java.lang.Long value) {
		Object oldValue = this.hungTaskThreshold;
		this.hungTaskThreshold = value;
		if (this.pcs != null)
			this.pcs.firePropertyChange("hungTaskThreshold", oldValue, value);
		return (T) this;
	}

	/**
	 * The JNDI Name to lookup the managed scheduled executor service.
	 */
	@ModelNodeBinding(detypedName = "jndi-name")
	public String jndiName() {
		return this.jndiName;
	}

	/**
	 * The JNDI Name to lookup the managed scheduled executor service.
	 */
	@SuppressWarnings("unchecked")
	public T jndiName(java.lang.String value) {
		Object oldValue = this.jndiName;
		this.jndiName = value;
		if (this.pcs != null)
			this.pcs.firePropertyChange("jndiName", oldValue, value);
		return (T) this;
	}

	/**
	 * When the number of threads is greater than the core, this is the maximum
	 * time, in milliseconds, that excess idle threads will wait for new tasks
	 * before terminating.
	 */
	@ModelNodeBinding(detypedName = "keepalive-time")
	public Long keepaliveTime() {
		return this.keepaliveTime;
	}

	/**
	 * When the number of threads is greater than the core, this is the maximum
	 * time, in milliseconds, that excess idle threads will wait for new tasks
	 * before terminating.
	 */
	@SuppressWarnings("unchecked")
	public T keepaliveTime(java.lang.Long value) {
		Object oldValue = this.keepaliveTime;
		this.keepaliveTime = value;
		if (this.pcs != null)
			this.pcs.firePropertyChange("keepaliveTime", oldValue, value);
		return (T) this;
	}

	/**
	 * Flag which hints the duration of tasks executed by the scheduled
	 * executor.
	 */
	@ModelNodeBinding(detypedName = "long-running-tasks")
	public Boolean longRunningTasks() {
		return this.longRunningTasks;
	}

	/**
	 * Flag which hints the duration of tasks executed by the scheduled
	 * executor.
	 */
	@SuppressWarnings("unchecked")
	public T longRunningTasks(java.lang.Boolean value) {
		Object oldValue = this.longRunningTasks;
		this.longRunningTasks = value;
		if (this.pcs != null)
			this.pcs.firePropertyChange("longRunningTasks", oldValue, value);
		return (T) this;
	}

	/**
	 * The policy to be applied to aborted tasks.
	 */
	@ModelNodeBinding(detypedName = "reject-policy")
	public RejectPolicy rejectPolicy() {
		return this.rejectPolicy;
	}

	/**
	 * The policy to be applied to aborted tasks.
	 */
	@SuppressWarnings("unchecked")
	public T rejectPolicy(RejectPolicy value) {
		Object oldValue = this.rejectPolicy;
		this.rejectPolicy = value;
		if (this.pcs != null)
			this.pcs.firePropertyChange("rejectPolicy", oldValue, value);
		return (T) this;
	}

	/**
	 * The name of the thread factory to be used by the scheduled executor.
	 */
	@ModelNodeBinding(detypedName = "thread-factory")
	public String threadFactory() {
		return this.threadFactory;
	}

	/**
	 * The name of the thread factory to be used by the scheduled executor.
	 */
	@SuppressWarnings("unchecked")
	public T threadFactory(java.lang.String value) {
		Object oldValue = this.threadFactory;
		this.threadFactory = value;
		if (this.pcs != null)
			this.pcs.firePropertyChange("threadFactory", oldValue, value);
		return (T) this;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy