/** * Allows package private classes to update volatile ZooKeeper. */ void updateKeeper(SolrZooKeeper keeper) throws InterruptedException { SolrZooKeeper oldKeeper = this.keeper; this.keeper = keeper; if (oldKeeper != null) { oldKeeper.close(); } // we might have been closed already if (isClosed) this.keeper.close(); }
/** * Allows package private classes to update volatile ZooKeeper. */ void updateKeeper(SolrZooKeeper keeper) throws InterruptedException { SolrZooKeeper oldKeeper = this.keeper; this.keeper = keeper; if (oldKeeper != null) { oldKeeper.close(); } // we might have been closed already if (isClosed) this.keeper.close(); }
private void closeKeeper(SolrZooKeeper keeper) { if (keeper != null) { try { keeper.close(); } catch (InterruptedException e) { // Restore the interrupted status Thread.currentThread().interrupt(); log.error("", e); throw new ZooKeeperException(SolrException.ErrorCode.SERVER_ERROR, "", e); } } }
private void closeKeeper(SolrZooKeeper keeper) { try { keeper.close(); } catch (InterruptedException e) { // Restore the interrupted status Thread.currentThread().interrupt(); log.error("", e); throw new ZooKeeperException(SolrException.ErrorCode.SERVER_ERROR, "", e); } } }
private void closeKeeper(SolrZooKeeper keeper) { try { keeper.close(); } catch (InterruptedException e) { // Restore the interrupted status Thread.currentThread().interrupt(); log.error("", e); throw new ZooKeeperException(SolrException.ErrorCode.SERVER_ERROR, "", e); } } }
private void closeKeeper(SolrZooKeeper keeper) { if (keeper != null) { try { keeper.close(); } catch (InterruptedException e) { // Restore the interrupted status Thread.currentThread().interrupt(); log.error("", e); throw new ZooKeeperException(SolrException.ErrorCode.SERVER_ERROR, "", e); } } }
@Override public void connect(String serverAddress, int timeout, Watcher watcher, ZkUpdate updater) throws IOException, InterruptedException, TimeoutException { SolrZooKeeper zk = createSolrZooKeeper(serverAddress, timeout, watcher); boolean success = false; try { updater.update(zk); success = true; } finally { if (!success) { zk.close(); } } }
@Override public void connect(String serverAddress, int timeout, Watcher watcher, ZkUpdate updater) throws IOException, InterruptedException, TimeoutException { SolrZooKeeper zk = createSolrZooKeeper(serverAddress, timeout, watcher); boolean success = false; try { updater.update(zk); success = true; } finally { if (!success) { zk.close(); } } }
@Override public void reconnect(final String serverAddress, final int zkClientTimeout, final Watcher watcher, final ZkUpdate updater) throws IOException { log.warn("Connection expired - starting a new one..."); SolrZooKeeper zk = createSolrZooKeeper(serverAddress, zkClientTimeout, watcher); boolean success = false; try { updater .update(zk); success = true; log.info("Reconnected to ZooKeeper"); } catch (Exception e) { SolrException.log(log, "Reconnect to ZooKeeper failed", e); log.warn("Reconnect to ZooKeeper failed"); } finally { if (!success) { try { zk.close(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } } } }
@Override public void reconnect(final String serverAddress, final int zkClientTimeout, final Watcher watcher, final ZkUpdate updater) throws IOException { log.info("Connection expired - starting a new one..."); SolrZooKeeper zk = createSolrZooKeeper(serverAddress, zkClientTimeout, watcher); boolean success = false; try { updater .update(zk); success = true; log.info("Reconnected to ZooKeeper"); } catch (Exception e) { SolrException.log(log, "Reconnect to ZooKeeper failed", e); log.info("Reconnect to ZooKeeper failed"); } finally { if (!success) { try { zk.close(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } } } }