Search in sources :

Example 1 with NodeExistsPolicy

use of org.apache.accumulo.fate.zookeeper.ZooUtil.NodeExistsPolicy in project accumulo by apache.

the class WalStateManager method updateState.

private void updateState(TServerInstance tsi, Path path, WalState state) throws WalMarkerException {
    byte[] data = (state + "," + path).getBytes(UTF_8);
    try {
        NodeExistsPolicy policy = NodeExistsPolicy.OVERWRITE;
        if (state == WalState.OPEN) {
            policy = NodeExistsPolicy.FAIL;
        }
        log.debug("Setting {} to {}", path.getName(), state);
        zoo.putPersistentData(root() + "/" + tsi + "/" + path.getName(), data, policy);
    } catch (KeeperException | InterruptedException e) {
        throw new WalMarkerException(e);
    }
}
Also used : NodeExistsPolicy(org.apache.accumulo.fate.zookeeper.ZooUtil.NodeExistsPolicy) KeeperException(org.apache.zookeeper.KeeperException)

Aggregations

NodeExistsPolicy (org.apache.accumulo.fate.zookeeper.ZooUtil.NodeExistsPolicy)1 KeeperException (org.apache.zookeeper.KeeperException)1