org.apache.zookeeper.KeeperException.ConnectionLossException Java Examples
The following examples show how to use
org.apache.zookeeper.KeeperException.ConnectionLossException.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: HBaseReplicationEndpoint.java From hbase with Apache License 2.0 | 5 votes |
/** * A private method used to re-establish a zookeeper session with a peer cluster. * @param ke */ protected void reconnect(KeeperException ke) { if (ke instanceof ConnectionLossException || ke instanceof SessionExpiredException || ke instanceof AuthFailedException) { String clusterKey = ctx.getPeerConfig().getClusterKey(); LOG.warn("Lost the ZooKeeper connection for peer " + clusterKey, ke); try { reloadZkWatcher(); } catch (IOException io) { LOG.warn("Creation of ZookeeperWatcher failed for peer " + clusterKey, io); } } }
Example #2
Source File: ZooKeeperRegistrarService.java From helios with Apache License 2.0 | 5 votes |
@Override public void run(final boolean timeout) throws InterruptedException { final RetryScheduler retryScheduler = retryIntervalPolicy.newScheduler(); while (isAlive()) { final long sleep = retryScheduler.nextMillis(); boolean successfullyRegistered = false; try { successfullyRegistered = zooKeeperRegistrar.tryToRegister(client); } catch (Exception e) { if (e instanceof ConnectionLossException) { log.warn("ZooKeeper connection lost, retrying registration in {} ms", sleep); } else if (e instanceof HostNotFoundException) { log.error("ZooKeeper deregistration of old hostname failed, retrying in {} ms: {}", sleep, e); } else { log.error("ZooKeeper registration failed, retrying in {} ms", sleep, e); } } // only exit the loop when zookeeper registration is successful. if registration does not // succeed because another host is already registered, this will cause another registration // attempt after sleeping. if zookeeper is cannot be connected to, this will also cause // another attempt after sleeping. if (successfullyRegistered) { log.info("Successfully registered host in zookeeper"); zkRegistrationSignal.ifPresent(CountDownLatch::countDown); return; } else { log.warn("registration not successful, sleeping for {} seconds", TimeUnit.MILLISECONDS.toSeconds(sleep)); sleeper.sleep(sleep); } } }
Example #3
Source File: NativeZookeeperExceptionHandler.java From opensharding-spi-impl with Apache License 2.0 | 4 votes |
private static boolean isIgnoredException(final Throwable cause) { return cause instanceof ConnectionLossException || cause instanceof NoNodeException || cause instanceof NodeExistsException; }
Example #4
Source File: RegExceptionHandler.java From shardingsphere-elasticjob-cloud with Apache License 2.0 | 4 votes |
private static boolean isIgnoredException(final Throwable cause) { return cause instanceof ConnectionLossException || cause instanceof NoNodeException || cause instanceof NodeExistsException; }
Example #5
Source File: RegExceptionHandlerTest.java From shardingsphere-elasticjob-cloud with Apache License 2.0 | 4 votes |
@Test public void assertHandleExceptionWithConnectionLossException() { RegExceptionHandler.handleException(new ConnectionLossException()); }
Example #6
Source File: RegExceptionHandlerTest.java From shardingsphere-elasticjob-cloud with Apache License 2.0 | 4 votes |
@Test public void assertHandleExceptionWithCausedConnectionLossException() { RegExceptionHandler.handleException(new RuntimeException(new ConnectionLossException())); }
Example #7
Source File: RegExceptionHandler.java From idworker with Apache License 2.0 | 4 votes |
private static boolean isIgnoredException(final Throwable cause) { return cause instanceof ConnectionLossException || cause instanceof NoNodeException || cause instanceof NodeExistsException; }
Example #8
Source File: CuratorZookeeperExceptionHandler.java From shardingsphere with Apache License 2.0 | 4 votes |
private static boolean isIgnoredException(final Throwable cause) { return cause instanceof ConnectionLossException || cause instanceof NoNodeException || cause instanceof NodeExistsException; }
Example #9
Source File: EmbedTestingServer.java From shardingsphere with Apache License 2.0 | 4 votes |
private static boolean isIgnoredException(final Throwable cause) { return cause instanceof ConnectionLossException || cause instanceof NoNodeException || cause instanceof NodeExistsException; }
Example #10
Source File: EmbedTestingServer.java From shardingsphere with Apache License 2.0 | 4 votes |
private static boolean isIgnoredException(final Throwable cause) { return cause instanceof ConnectionLossException || cause instanceof NoNodeException || cause instanceof NodeExistsException; }
Example #11
Source File: RegExceptionHandler.java From shardingsphere-elasticjob-lite with Apache License 2.0 | 4 votes |
private static boolean isIgnoredException(final Throwable cause) { return cause instanceof ConnectionLossException || cause instanceof NoNodeException || cause instanceof NodeExistsException; }
Example #12
Source File: RegExceptionHandlerTest.java From shardingsphere-elasticjob-lite with Apache License 2.0 | 4 votes |
@Test public void assertHandleExceptionWithConnectionLossException() { RegExceptionHandler.handleException(new ConnectionLossException()); }
Example #13
Source File: RegExceptionHandlerTest.java From shardingsphere-elasticjob-lite with Apache License 2.0 | 4 votes |
@Test public void assertHandleExceptionWithCausedConnectionLossException() { RegExceptionHandler.handleException(new RuntimeException(new ConnectionLossException())); }