diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2016-09-25 13:42:19 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2016-09-25 13:42:19 +0000 |
commit | 0c0f50e55e7c8f5906c64fddc21d3ca45f95c13e (patch) | |
tree | 2b1dac112cff4b2abdee8df6c8f39bb78393fe48 /filedistribution | |
parent | c71f0a7d0412c01240ae36fe6002e55992e202e0 (diff) |
Just exit on zookeeper errors.
Diffstat (limited to 'filedistribution')
-rw-r--r-- | filedistribution/src/vespa/filedistribution/model/zkfacade.cpp | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/filedistribution/src/vespa/filedistribution/model/zkfacade.cpp b/filedistribution/src/vespa/filedistribution/model/zkfacade.cpp index f52b3a7e616..34705729703 100644 --- a/filedistribution/src/vespa/filedistribution/model/zkfacade.cpp +++ b/filedistribution/src/vespa/filedistribution/model/zkfacade.cpp @@ -237,19 +237,23 @@ struct ZKFacade::ZKWatcher { void ZKFacade::stateWatchingFun(zhandle_t*, int type, int state, const char* path, void* context) { - (void)path; (void)context; //The ZKFacade won't expire before zookeeper_close has finished. - if (type == ZOO_SESSION_EVENT) { - LOGFWD(debug, "Zookeeper session event: %d", state); - if (state == ZOO_EXPIRED_SESSION_STATE) { - throw ZKSessionExpired(path, VESPA_STRLOC); - } else if (state == ZOO_AUTH_FAILED_STATE) { - throw ZKGenericException(ZNOAUTH, path, VESPA_STRLOC); + try { + if (type == ZOO_SESSION_EVENT) { + LOGFWD(debug, "Zookeeper session event: %d", state); + if (state == ZOO_EXPIRED_SESSION_STATE) { + throw ZKSessionExpired(path, VESPA_STRLOC); + } else if (state == ZOO_AUTH_FAILED_STATE) { + throw ZKGenericException(ZNOAUTH, path, VESPA_STRLOC); + } + } else { + LOGFWD(info, "State watching function: Unexpected event: '%d' -- '%d' ", type, state); } - } else { - LOGFWD(info, "State watching function: Unexpected event: '%d' -- '%d' ", type, state); + } catch (ZKSessionExpired & e) { + LOGFWD(error, "Received ZKSessionExpired exception that I can not handle. Will just exit quietly : %s", e.what()); + std::quick_exit(11); } } |