Exemplo n.º 1
0
void global_watcher(zhandle_t *zzh, int type, int state,
                const char *path, void* context)
{
    /* Be careful using zh here rather than zzh - as this may be mt code
     * the client lib may call the global_watcher before zookeeper_init returns */

    if (path && strlen(path) > 0) {
        LOG("type=%s, state=%s, path=%s", type_to_string(type),
            state_to_string(state), path);
    } else {
        LOG("type=%s, state=%s", type_to_string(type), state_to_string(state));
    }

    ConfigManager* cm = reinterpret_cast<ConfigManager*>(context);
    cm->handle_zk_event(zzh, path, type, state);
}