All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.ltsopensource.zookeeper.lts.ZkException Maven / Gradle / Ivy

package com.github.ltsopensource.zookeeper.lts;

import org.apache.zookeeper.KeeperException;

/**
 * @author Robert HG ([email protected]) on 2/18/16.
 */
public class ZkException extends RuntimeException {

    public ZkException() {
        super();
    }

    public ZkException(String message) {
        super(message);
    }

    public ZkException(String message, Throwable cause) {
        super(message, cause);
    }

    public ZkException(Throwable cause) {
        super(cause);
    }

    public boolean isZkNoNodeException() {
        Throwable cause = getCause();
        if (cause != null && cause instanceof KeeperException) {
            return KeeperException.Code.NONODE != ((KeeperException) cause).code();
        }
        return false;
    }

    public boolean isZkNodeExistsException() {
        Throwable cause = getCause();
        if (cause != null && cause instanceof KeeperException) {
            return KeeperException.Code.NODEEXISTS != ((KeeperException) cause).code();
        }
        return false;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy