TIBCO Adapter SDK C++ Reference
MTimer::MTimer
MTimer
Constructor for creating MTimer instances. This constructor should be used only for a TIBCO Rendezvous session to create the timer using the specified session.

The timer is started as soon as the MTimer instance is constructed. Applications can deactivate the MTimer by calling MTimer::deactivate().

Remarks
If you use a timer, you should also create an instance of MEventListener with the appropriate onEvent() method to serve as the event handler and associate the timer and the listener by calling the timer’s inherited addListener() method. See MEventSource::addListener().

Timers are used in applications that poll based on a continuous interval instead of, for example, listening for data.

A timer name must be unique across one MApp application manager.

The following code fragment generates a repeating timer, which triggers at 2 second intervals, and the corresponding event listener.

int nInterval = 2;
m_pMTimer = new MTimer( this, "my_timer", nInterval, true );
m_pMTimer->addListener( m_pTimerEventHandler );
Parameters
Parameters Description
MApp* pMApp Pointer to MApp application manager for this MTimer.
const MString& rsName Name of this timer. Must be unique.
const MString& rsSessionName Name of the TIBCO Rendezvous session in which this timer is created.
unsigned long iInterval Interval of this timer activity, in milliseconds.
Mboolean bRepeating If set to true (the default), create a repeating timer. A repeating timer reschedules itself each time it triggers; the effect is a potentially endless series of timer events at a regular interval. If set
Mboolean bMustActivate = Mtrue When set to true (the default) this timer is created as an active timer. Otherwise, applications have to explicitly call the activate() method.
only timer.
Exceptions
M_ERROR_DATA_INVALID_PARAMETER_VALUE,

M_ERROR_RV_EVM_ERROR,

MException on any failure to create or activate the timer.

Declaration
MTimer(MApp* pMApp, const MString& rsName, const MString& rsSessionName, unsigned long iInterval, Mboolean bRepeating, Mboolean bMustActivate = Mtrue) throw(MException);
Links
Copyright (c) 2010 TIBCO Software Inc. All rights reserved.