Exemplo n.º 1
0
 public function getInstance()
 {
     if (!isset(self::$_instance)) {
         $c = __CLASS__;
         self::$_instance = new $c();
         if (FALSE === self::$_instance->load_conf()) {
             AlarmLog::err(__FILE__, __LINE__, "load conf failed!");
             return FALSE;
         }
     }
     return self::$_instance;
 }
Exemplo n.º 2
0
function qconf_alarm_func($msg)
{
    // 1. Parse message
    echo "receive message";
    //return true;
    $alarmMsgs = AlarmMsgParser::parse($msg);
    if (FALSE === $alarmMsgs) {
        AlarmLog::err(__FILE__, __LINE__, "failed to parse msg!");
        return true;
    }
    //printInfo($alarmMsgs);
    foreach ($alarmMsgs as $item) {
        // 2. pass strategy
        $strategy_control = AlarmStrategyController::getInstance();
        //var_dump($strategy_control);
        if (FALSE === $strategy_control) {
            AlarmLog::err(__FILE__, __LINE__, "failed to get  AlarmStrategyController instance!");
            return true;
        }
        $strategy_control->passStrategy($item);
    }
    return true;
}