Class ThreadPool
java.lang.Object
java.lang.ThreadGroup
org.jpos.util.ThreadPool
- All Implemented Interfaces:
Thread.UncaughtExceptionHandler, Configurable, Loggeable, LogSource, ThreadPoolMBean
@Deprecated
public class ThreadPool
extends ThreadGroup
implements LogSource, Loggeable, Configurable, ThreadPoolMBean
Deprecated.
Used Executor framework
Implements a ThreadPool with the ability to run simple Runnable
tasks as well as Jobs (supervised Runnable tasks)
- Since:
- 1.1
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceDeprecated.Marks jobs that can be supervised and interrupted when expired. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intDeprecated.Default maximum number of threads when no explicit limit is configured. -
Constructor Summary
ConstructorsConstructorDescriptionDeprecated.Default constructor for ThreadPoolThreadPool(int poolSize, int maxPoolSize) Deprecated.Constructs a ThreadPool with the default name"ThreadPool".ThreadPool(int poolSize, int maxPoolSize, String name) Deprecated.Constructs a ThreadPool with an explicit name. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Deprecated.Closes the pool queue and stops accepting new jobs.voiddump(PrintStream p, String indent) Deprecated.Dumps a human-readable representation of this object to the print stream.voidDeprecated.Executes a runnable using the pool infrastructure.intDeprecated.Returns the number of threads currently executing a job.intDeprecated.Returns the number of threads available to accept new work without spawning.intDeprecated.Returns the number of threads currently waiting for work.intDeprecated.Returns the number of jobs processed by this pool.Deprecated.Returns the Logger associated with this source.intDeprecated.Returns the maximum number of threads allowed in the pool.intDeprecated.Returns the number of pending jobs.intDeprecated.Returns the number of running threads in the pool.getRealm()Deprecated.Returns the log realm associated with this source.static ThreadPoolgetThreadPool(String name) Deprecated.Retrieves a thread pool from NameRegistrar given its name, unique identifier.voidDeprecated.Configures this object with the suppliedConfiguration.voidDeprecated.Attaches aLoggerand realm to this log source.voidDeprecated.Supervises pooled threads and interrupts expired supervised jobs.Methods inherited from class ThreadGroup
activeCount, activeGroupCount, checkAccess, destroy, enumerate, enumerate, enumerate, enumerate, getMaxPriority, getName, getParent, interrupt, isDaemon, isDestroyed, list, parentOf, setDaemon, setMaxPriority, toString, uncaughtExceptionMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface Loggeable
dumpModifier and TypeMethodDescriptiondefault voiddump(PrintStream p, String indent, LogRenderer.Type type) Dumps a representation of this object using the specified renderer type.
-
Field Details
-
DEFAULT_MAX_THREADS
Deprecated.Default maximum number of threads when no explicit limit is configured.- See Also:
-
-
Constructor Details
-
ThreadPool
Deprecated.Constructs a ThreadPool with the default name"ThreadPool".- Parameters:
poolSize- starting pool sizemaxPoolSize- maximum number of threads on this pool
-
ThreadPool
Deprecated.Constructs a ThreadPool with an explicit name.- Parameters:
poolSize- starting pool sizemaxPoolSize- maximum number of threads on this poolname- pool name
-
ThreadPool
-
-
Method Details
-
close
-
execute
Deprecated.Executes a runnable using the pool infrastructure.- Parameters:
action- runnable to execute- Throws:
BlockingQueue.Closed- if the pool is no longer accepting jobs
-
dump
-
getJobCount
Deprecated.Description copied from interface:ThreadPoolMBeanReturns the number of jobs processed by this pool.- Specified by:
getJobCountin interfaceThreadPoolMBean- Returns:
- number of jobs processed by this pool
-
getPoolSize
Deprecated.Description copied from interface:ThreadPoolMBeanReturns the number of running threads in the pool.- Specified by:
getPoolSizein interfaceThreadPoolMBean- Returns:
- number of running threads
-
getMaxPoolSize
Deprecated.Description copied from interface:ThreadPoolMBeanReturns the maximum number of threads allowed in the pool.- Specified by:
getMaxPoolSizein interfaceThreadPoolMBean- Returns:
- max number of active threads allowed
-
getActiveCount
Deprecated.Returns the number of threads currently executing a job.- Returns:
- number of active threads
-
getIdleCount
Deprecated.Returns the number of threads currently waiting for work.- Specified by:
getIdleCountin interfaceThreadPoolMBean- Returns:
- number of idle threads
-
getAvailableCount
Deprecated.Returns the number of threads available to accept new work without spawning.- Returns:
- number of available threads
-
getPendingCount
Deprecated.Description copied from interface:ThreadPoolMBeanReturns the number of pending jobs.- Specified by:
getPendingCountin interfaceThreadPoolMBean- Returns:
- number of Pending jobs
-
supervise
Deprecated.Supervises pooled threads and interrupts expired supervised jobs. -
setLogger
-
getRealm
-
getLogger
-
setConfiguration
Deprecated.Description copied from interface:ConfigurableConfigures this object with the suppliedConfiguration.- Specified by:
setConfigurationin interfaceConfigurable- Parameters:
cfg- Configuration object- Throws:
ConfigurationException- if configuration is invalid
-
getThreadPool
Deprecated.Retrieves a thread pool from NameRegistrar given its name, unique identifier.- Parameters:
name- Name of the thread pool to retrieve, must be the same as the name property of the thread-pool tag in the QSP config file- Returns:
- returns the retrieved instance of thread pool
- Throws:
NameRegistrar.NotFoundException- thrown when there is not a thread-pool registered under this name.
-