Search in sources :

Example 31 with KeeperException

use of org.apache.flink.shaded.zookeeper3.org.apache.zookeeper.KeeperException in project hbase by apache.

the class HBaseAdmin method getMasterAddress.

private ServerName getMasterAddress() throws IOException {
    // TODO: Fix!  Reaching into internal implementation!!!!
    ConnectionImplementation connection = (ConnectionImplementation) this.connection;
    ZooKeeperKeepAliveConnection zkw = connection.getKeepAliveZooKeeperWatcher();
    try {
        return MasterAddressTracker.getMasterAddress(zkw);
    } catch (KeeperException e) {
        throw new IOException("Failed to get master server name from MasterAddressTracker", e);
    }
}
Also used : InterruptedIOException(java.io.InterruptedIOException) IOException(java.io.IOException) DoNotRetryIOException(org.apache.hadoop.hbase.DoNotRetryIOException) TimeoutIOException(org.apache.hadoop.hbase.exceptions.TimeoutIOException) KeeperException(org.apache.zookeeper.KeeperException)

Example 32 with KeeperException

use of org.apache.flink.shaded.zookeeper3.org.apache.zookeeper.KeeperException in project hadoop by apache.

the class ZKClient method getServiceData.

/**
   * get data published by the service at the registration address
   * @param path the path where the service is registered 
   * @return  the data of the registered service
   * @throws IOException
   * @throws InterruptedException
   */
public String getServiceData(String path) throws IOException, InterruptedException {
    String data;
    try {
        Stat stat = new Stat();
        byte[] byteData = zkClient.getData(path, false, stat);
        data = new String(byteData, Charset.forName("UTF-8"));
    } catch (KeeperException ke) {
        throw new IOException(ke);
    }
    return data;
}
Also used : Stat(org.apache.zookeeper.data.Stat) IOException(java.io.IOException) KeeperException(org.apache.zookeeper.KeeperException)

Example 33 with KeeperException

use of org.apache.flink.shaded.zookeeper3.org.apache.zookeeper.KeeperException in project hadoop by apache.

the class TestActiveStandbyElector method testParentZNodeACLs.

/**
   * Test that ACLs are set on parent zNode even if the node already exists.
   */
@Test
public void testParentZNodeACLs() throws Exception {
    KeeperException ke = new KeeperException(Code.NODEEXISTS) {

        @Override
        public Code code() {
            return super.code();
        }
    };
    Mockito.when(mockZK.create(Mockito.anyString(), Mockito.eq(new byte[] {}), Mockito.anyListOf(ACL.class), Mockito.eq(CreateMode.PERSISTENT))).thenThrow(ke);
    elector.ensureParentZNode();
    StringBuilder prefix = new StringBuilder();
    for (String part : ZK_PARENT_NAME.split("/")) {
        if (part.isEmpty())
            continue;
        prefix.append("/").append(part);
        if (!"/".equals(prefix.toString())) {
            Mockito.verify(mockZK).getACL(Mockito.eq(prefix.toString()), Mockito.eq(new Stat()));
            Mockito.verify(mockZK).setACL(Mockito.eq(prefix.toString()), Mockito.eq(Ids.OPEN_ACL_UNSAFE), Mockito.anyInt());
        }
    }
}
Also used : Stat(org.apache.zookeeper.data.Stat) ACL(org.apache.zookeeper.data.ACL) KeeperException(org.apache.zookeeper.KeeperException) Test(org.junit.Test)

Example 34 with KeeperException

use of org.apache.flink.shaded.zookeeper3.org.apache.zookeeper.KeeperException in project pinpoint by naver.

the class DefaultZookeeperClient method delete.

@Override
public void delete(String path) throws PinpointZookeeperException, InterruptedException {
    checkState();
    ZooKeeper zookeeper = this.zookeeper;
    try {
        zookeeper.delete(path, -1);
    } catch (KeeperException exception) {
        if (exception.code() != Code.NONODE) {
            handleException(exception);
        }
    }
}
Also used : ZooKeeper(org.apache.zookeeper.ZooKeeper) KeeperException(org.apache.zookeeper.KeeperException)

Example 35 with KeeperException

use of org.apache.flink.shaded.zookeeper3.org.apache.zookeeper.KeeperException in project pinpoint by naver.

the class DefaultZookeeperClient method getData.

@Override
public byte[] getData(String path) throws PinpointZookeeperException, InterruptedException {
    checkState();
    ZooKeeper zookeeper = this.zookeeper;
    try {
        return zookeeper.getData(path, false, null);
    } catch (KeeperException exception) {
        handleException(exception);
    }
    throw new UnknownException("UnknownException.");
}
Also used : ZooKeeper(org.apache.zookeeper.ZooKeeper) UnknownException(com.navercorp.pinpoint.collector.cluster.zookeeper.exception.UnknownException) KeeperException(org.apache.zookeeper.KeeperException)

Aggregations

KeeperException (org.apache.zookeeper.KeeperException)608 IOException (java.io.IOException)206 Stat (org.apache.zookeeper.data.Stat)131 ZooKeeper (org.apache.zookeeper.ZooKeeper)89 ArrayList (java.util.ArrayList)55 NoNodeException (org.apache.zookeeper.KeeperException.NoNodeException)45 Watcher (org.apache.zookeeper.Watcher)43 WatchedEvent (org.apache.zookeeper.WatchedEvent)42 Test (org.junit.jupiter.api.Test)38 HashMap (java.util.HashMap)33 List (java.util.List)32 CountDownLatch (java.util.concurrent.CountDownLatch)32 SolrException (org.apache.solr.common.SolrException)30 Test (org.junit.Test)29 ACL (org.apache.zookeeper.data.ACL)27 Map (java.util.Map)26 HeliosRuntimeException (com.spotify.helios.common.HeliosRuntimeException)25 AccumuloSecurityException (org.apache.accumulo.core.client.AccumuloSecurityException)24 ServerName (org.apache.hadoop.hbase.ServerName)24 OpResult (org.apache.zookeeper.OpResult)21