TimerTask Class

Represents a timer task to be executed in the context of the corresponding IContext thread. To create and start a TimerTask please see Start(IContext, TimerCallback, TimerMode, Int64, Object).


Namespace: SolaceSystems.Solclient.Messaging
Assembly: SolaceSystems.Solclient.Messaging (in SolaceSystems.Solclient.Messaging.dll) Version: 10.24.0
public abstract class TimerTask : IDisposable
Object    TimerTask


TimerTaskInitializes a new instance of the TimerTask class


DurationInMsecs The duration in milliseconds of the timer.
Mode The TimerMode specified when the timer is created Start(IContext, TimerCallback, TimerMode, Int64, Object)
UserState A reference to a user userState object. Passed in with the timer callback invocation.


DisposeReleases all resources used by the TimerTask
EqualsDetermines whether the specified object is equal to the current object.
(Inherited from Object)
FinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object)
GetHashCodeServes as the default hash function.
(Inherited from Object)
GetTypeGets the Type of the current instance.
(Inherited from Object)
MemberwiseCloneCreates a shallow copy of the current Object.
(Inherited from Object)
Start Factory method of TimerTasks. A TimerTask allows applications to execute a user-defined delegate in the context of a given IContext thread. The timer duration is subject to the timer resolution specified by the context property 'TimerResolutionInMsecs', up to the nearest timer resolution interval. For example, if the context timer resolution is 50 ms, and a timer is started with a duration of 60 ms, then the timer duration is rounded up to 100 ms (2 ticks), and then one further tick is added for a total timer duration of 150 ms. This extra tick accounts for the fact that the current tick might be just about to advance when the timer is started. Thus, the actual timeout in this example is approximately in the range of 100 ms to 150 ms.

The timer callback delegate is invoked in the context of the context thread. The timer durations are approximate; the actual duration can be affected by the processing time spent in other callbacks by the context thread, such as for session or flowEvent events and received messages.

Note: disposing the corresponding context (IContext) or any of its contained context timers (TimerTask), sessions (ISession) or flows (IFlow) must not be performed from within the registered userCallbackDelegate.

This timer service should only be used for applications that require a coarse timer service (for example, a guard timer, or other timer uses that do not require a highly accurate timer service).

When a one-shot timer expires, the timer is automatically cancelled. When a repeat timer expires, the timer is automatically rescheduled for the same duration, and continues to run until stopped using Dispose.

Note that the invoked timer callback delegate routine is allowed to start and stop timers.

ToStringReturns a string that represents the current object.
(Inherited from Object)

See Also