mirror of https://github.com/apache/nifi.git
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:
parent
a931e72787
commit
35d2b921ea
|
@ -439,7 +439,15 @@ public class ZooKeeperStateProvider extends AbstractStateProvider {
|
||||||
setState(newValue, (int) oldValue.getVersion(), componentId);
|
setState(newValue, (int) oldValue.getVersion(), componentId);
|
||||||
return true;
|
return true;
|
||||||
} catch (final IOException ioe) {
|
} 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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue