//发布订阅 EventEmitter code // 当某配置发生变化时,通知到已订阅的客户端 void HocfgMgr::notifyChange( const string&; filename, int mtime ) const { string aliasPrefix = _F("%s_%s@", BOOK_HOCFG_ALIAS_PREFIX, filename.c_str()); CliMgr::AliasCursor alcr(aliasPrefix); CliBase *cli = NULL; vector vecCli; string msg("{"); StrParse::PutOneJson(msg, "notify", "cfg_change", true); StrParse::PutOneJson(msg, "filename", filename, true); StrParse::PutOneJson(msg, "mtime", mtime, false); msg += "}"; while ((cli = alcr.pop())) { IOHand* iohand = dynamic_cast(cli); if (NULL == iohand) { LOGWARN("NOTIFYCHANGE| msg=book from ocli| cli=%s| file=%s", cli->m_idProfile.c_str(), filename.c_str()); continue; } iohand->sendData(CMD_EVNOTIFY_REQ, ++m_seqid, msg.c_str(), msg.size(), true); } }
点赞 1

相关推荐

09-18 20:41
门头沟学院 Java
要个offer怎么这...:哈哈哈哈哈哈,我也拿了0x10000000个offer,秋招温啦啦啦,好开心
我的秋招日记
点赞 评论 收藏
分享
团子请爱我一次_十月...:不是戈门,干哪来了,这就是java嘛
点赞 评论 收藏
分享
牛客网
牛客网在线编程
牛客网题解
牛客企业服务