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,10 +439,18 @@ 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) {
|
||||||
|
final Throwable cause = ioe.getCause();
|
||||||
|
if (cause != null && cause instanceof KeeperException) {
|
||||||
|
final KeeperException ke = (KeeperException) cause;
|
||||||
|
if (Code.BADVERSION == ke.code()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
throw ioe;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void clear(final String componentId) throws IOException {
|
public void clear(final String componentId) throws IOException {
|
||||||
|
|
Loading…
Reference in New Issue