Show / Hide Table of Contents

# Namespace Apache.NMS.ActiveMQ.Threads

### Classes

#### CompositeTaskRunner

A TaskRunner that dedicates a single thread to running a single Task.

#### DedicatedTaskRunner

A TaskRunner that dedicates a single thread to running a single Task.

#### DefaultThreadPools

#### Scheduler

Scheduler Service useful for running various delayed units of work.

#### TaskRunnerFactory

Manages the thread pool for long running tasks. Long running tasks are not always active but when they are active, they may need a few iterations of processing for them to become idle. The manager ensures that each task is processes but that no one task overtakes the system. This is kina like cooperative multitasking.

If your OS/JVM combination has a good thread model, you may want to avoid using a thread pool to run tasks and use a DedicatedTaskRunner instead.

#### ThreadPoolExecutor

This class provides a wrapper around the ThreadPool mechanism in .NET to allow for serial execution of jobs in the ThreadPool and provide a means of shutting down the execution of jobs in a deterministic way.

#### TimerEx

A facility for applications to schedule tasks for future execution in a background thread. Tasks may be scheduled for one-time execution, or for repeated execution at regular intervals. Unlike the normal .NET Timer this Timer allows for multiple tasks to be scheduled in a single Timer object.

Corresponding to each Timer object is a single background thread that is used to execute all of the timer's tasks, sequentially. Timer tasks should complete quickly. If a timer task takes excessive time to complete, it "hogs" the timer's task execution thread. This can, in turn, delay the execution of subsequent tasks, which may "bunch up" and execute in rapid succession when (and if) the offending task finally completes.

After the last live reference to a Timer object goes away and all outstanding tasks have completed execution, the timer's task execution thread terminates gracefully (and becomes subject to garbage collection). However, this can take arbitrarily long to occur. By default, the task execution thread does not run as a Background thread, so it is capable of keeping an application from terminating. If a caller wants to terminate a timer's task execution thread rapidly, the caller should invoke the timer's cancel method.

If the timer's task execution thread terminates unexpectedly, any further attempt to schedule a task on the timer will result in an IllegalStateException, as if the timer's cancel method had been invoked.

This class is thread-safe: multiple threads can share a single Timer object without the need for external synchronization.

This class does not offer real-time guarantees: it schedules tasks using the EventWaitHandle.WaitOne(TimeSpan) method.

#### TimerTask

A Task that is run in a Timer instance either once or repeatedly.

### Interfaces

#### CompositeTask

A Composite task is one of N tasks that can be managed by a CompositTaskRunner instance. The CompositeTaskRunner checks each task when its wakeup method is called to determine if the Task has any work it needs to complete, if no tasks have any pending work then the CompositeTaskRunner can return to its sleep state until the next time its wakeup method is called or it is shut down.

#### Task

Represents a task that may take a few iterations to complete.

#### TaskRunner

Allows you to request a thread execute the associated Task.