예제 #1
0
void service_watcher_g(zhandle_t * zh, int type, int state, const char* path, void* watcherCtx) {
    DEBUG_PRINT("global watcher - type:%d,state:%d", type, state);
    if ( type==ZOO_SESSION_EVENT ) {
        if ( state==ZOO_CONNECTED_STATE ) {
            DEBUG_PRINT("connected to zookeeper service successfully!","");
            DEBUG_PRINT("timeout:%d", zoo_recv_timeout(zh));
        }
        else if ( state==ZOO_EXPIRED_SESSION_STATE ) {
            DEBUG_PRINT("zookeeper session expired!","");
        }
    }
    else {
        DEBUG_PRINT("other type:%d", type);
    }
}
예제 #2
0
static VALUE method_recv_timeout(VALUE self) {
  FETCH_DATA_PTR(self, zk);
  return INT2NUM(zoo_recv_timeout(zk->zh));
}
예제 #3
0
static VALUE zkrb_gvl_zoo_recv_timeout(void *data) {
  zkrb_zoo_recv_timeout_args_t *a = (zkrb_zoo_recv_timeout_args_t *)data;
  a->rc = zoo_recv_timeout(a->zh);
  return Qnil;
}