setHeartbeatTimes
setHeartbeatTimes — sets the period of the heartbeat timers.
ST_STATUS setHeartbeatTimes( | heartbeat_ms, | |
timeout_ms); |
long heartbeat_ms;long timeout_ms;Exception setHeartbeatTimes( | heartbeat_ms, | |
timeout_ms); |
long heartbeat_ms;long timeout_ms;heartbeat_msThe period in milliseconds for the heartbeat timer, or
0 if a timer will not be used.
timeout_msThe period in milliseconds for the timeout timer, or
0 if a timer will not be used.
ST_OK if the timer values accepted, otherwise
ST_ERROR. ST_ERROR can occur for
the following reasons:
The timeout timer value is not greater than heartbeat (if both values
are greater than 0).
The timers were already active and either timer failed to restart.
The DataHub instance and API provide two heartbeat services to ensure the integrity of the connection:
A local, internal timeout timer, which when it fires, will close the connection and generate an error.
A periodic 'alive' heartbeat message from the DataHub instance, which
triggers the virtual method
onAlive.
The timers can be started with
startHeartbeatTimers once the respective
periods have been set. If a timer is already running when
setHeartbeatTimes is called, then that timer is
restarted with the new period. If the timer is already running and the specified
period is 0, then the timer is stopped.
The timeout timer is automatically reset whenever there is any activity over the connection, including the heartbeat timer message.