fixed zkutil_test. [#METR-2807]

This commit is contained in:
Michael Kolupaev 2014-06-30 11:58:16 +04:00
parent 7d179c4294
commit 33a88e83ae
3 changed files with 6 additions and 18 deletions

View File

@ -121,8 +121,6 @@ public:
Stat * stat = nullptr,
WatchFuture * watch = nullptr);
void close();
/** Транзакционно выполняет несколько операций. При любой ошибке бросает исключение.
*/
OpResultsPtr multi(const Ops & ops);

View File

@ -409,9 +409,13 @@ void ZooKeeper::removeRecursive(const std::string & path)
remove(path);
}
void ZooKeeper::close()
ZooKeeper::~ZooKeeper()
{
check(zookeeper_close(impl));
int code = zookeeper_close(impl);
if (code != ZOK)
{
LOG_ERROR(&Logger::get("~ZooKeeper"), "Failed to close ZooKeeper session: " << zerror(code));
}
/// удаляем WatchWithPromise которые уже никогда не будут обработаны
for (WatchWithPromise * watch : watch_store)
@ -419,18 +423,6 @@ void ZooKeeper::close()
watch_store.clear();
}
ZooKeeper::~ZooKeeper()
{
try
{
close();
}
catch(...)
{
LOG_ERROR(&Logger::get("~ZooKeeper"), "Failed to close ZooKeeper session");
}
}
ZooKeeperPtr ZooKeeper::startNewSession() const
{
return new ZooKeeper(hosts, sessionTimeoutMs, state_watch);

View File

@ -209,8 +209,6 @@ int main(int argc, char ** argv)
std::cerr << "KeeperException: " << e.displayText() << std::endl;
}
}
zk.close();
}
catch (zkutil::KeeperException & e)
{