NIFI-259: Distinguish between unable to communicate with ZK and 'bad version' when performing 'replace' method of ZooKeeperStateProvider

Signed-off-by: Aldrin Piri <aldrin@apache.org>
This commit is contained in:
Mark Payne 2016-02-01 16:12:01 -05:00 committed by Aldrin Piri
parent a931e72787
commit 35d2b921ea
1 changed files with 9 additions and 1 deletions

View File

@ -439,7 +439,15 @@ public class ZooKeeperStateProvider extends AbstractStateProvider {
setState(newValue, (int) oldValue.getVersion(), componentId);
return true;
} catch (final IOException ioe) {
return false;
final Throwable cause = ioe.getCause();
if (cause != null && cause instanceof KeeperException) {
final KeeperException ke = (KeeperException) cause;
if (Code.BADVERSION == ke.code()) {
return false;
}
}
throw ioe;
}
}