STTNet
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Public Member Functions | Static Public Member Functions | List of all members
stt::system::HBSystem Class Reference

Class responsible for process heartbeat monitoring and scheduling Used to monitor service processes and ensure they continue to run effectively After the process ends, the shared memory at 0x5095 and the semaphore are not deleted Currently only supports processes with up to three parameters to join monitoring The logic of joining the heartbeat monitoring system, updating heartbeats, and checking the heartbeat system should be manually written in the program. This class only provides call interfaces. More...

#include <sttnet_English.h>

Public Member Functions

bool join (const char *name, const char *argv0="", const char *argv1="", const char *argv2="")
 Add a process to the heartbeat system. More...
 
bool renew ()
 Update the heartbeat of the current process. More...
 
bool deleteFromHBS ()
 Remove the current process from the heartbeat system. More...
 
 ~HBSystem ()
 Destructor of HBSystem. More...
 

Static Public Member Functions

static void list ()
 Output information of all processes in the heartbeat monitoring system. More...
 
static bool HBCheck (const int &sec)
 Check the heartbeat monitoring system If the time difference between the last heartbeat update and the current time is greater than or equal to sec seconds, kill the process First send signal 15 to kill the process. If the process still exists after 8 seconds, send signal 9 to force kill. More...
 

Detailed Description

Class responsible for process heartbeat monitoring and scheduling Used to monitor service processes and ensure they continue to run effectively After the process ends, the shared memory at 0x5095 and the semaphore are not deleted Currently only supports processes with up to three parameters to join monitoring The logic of joining the heartbeat monitoring system, updating heartbeats, and checking the heartbeat system should be manually written in the program. This class only provides call interfaces.

Constructor & Destructor Documentation

stt::system::HBSystem::~HBSystem ( )

Destructor of HBSystem.

  • Remove the current process from the heartbeat system

Member Function Documentation

bool stt::system::HBSystem::deleteFromHBS ( )

Remove the current process from the heartbeat system.

Returns
true: Operation successful, false: Operation failed
static bool stt::system::HBSystem::HBCheck ( const int &  sec)
static

Check the heartbeat monitoring system If the time difference between the last heartbeat update and the current time is greater than or equal to sec seconds, kill the process First send signal 15 to kill the process. If the process still exists after 8 seconds, send signal 9 to force kill.

Returns
true: Operation successful, false: Operation failed
bool stt::system::HBSystem::join ( const char *  name,
const char *  argv0 = "",
const char *  argv1 = "",
const char *  argv2 = "" 
)

Add a process to the heartbeat system.

Parameters
nameAbsolute path of the process name
argv0First parameter of the process
argv1Second parameter of the process
argv2Third parameter of the process
Returns
true: Joined successfully, false: Join failed
static void stt::system::HBSystem::list ( )
static

Output information of all processes in the heartbeat monitoring system.

bool stt::system::HBSystem::renew ( )

Update the heartbeat of the current process.

Returns
true: Updated successfully, false: Update failed

The documentation for this class was generated from the following file: