/** * Try to delete the "ActiveBreadCrumb" node when gracefully giving up * active status. * If this fails, it will simply warn, since the graceful release behavior * is only an optimization. */ private void tryDeleteOwnBreadCrumbNode() { assert state == State.ACTIVE; LOG.info("Deleting bread-crumb of active node..."); // Sanity check the data. This shouldn't be strictly necessary, // but better to play it safe. Stat stat = new Stat(); byte[] data = null; try { data = zkClient.getData(zkBreadCrumbPath, false, stat); if (!Arrays.equals(data, appData)) { throw new IllegalStateException( "We thought we were active, but in fact " + "the active znode had the wrong data: " + StringUtils.byteToHexString(data) + " (stat=" + stat + ")"); } deleteWithRetries(zkBreadCrumbPath, stat.getVersion()); } catch (Exception e) { LOG.warn("Unable to delete our own bread-crumb of being active at {}." + ". Expecting to be fenced by the next active.", zkBreadCrumbPath, e); } }
/** * Try to delete the "ActiveBreadCrumb" node when gracefully giving up * active status. * If this fails, it will simply warn, since the graceful release behavior * is only an optimization. */ private void tryDeleteOwnBreadCrumbNode() { assert state == State.ACTIVE; LOG.info("Deleting bread-crumb of active node..."); // Sanity check the data. This shouldn't be strictly necessary, // but better to play it safe. Stat stat = new Stat(); byte[] data = null; try { data = zkClient.getData(zkBreadCrumbPath, false, stat); if (!Arrays.equals(data, appData)) { throw new IllegalStateException( "We thought we were active, but in fact " + "the active znode had the wrong data: " + StringUtils.byteToHexString(data) + " (stat=" + stat + ")"); } deleteWithRetries(zkBreadCrumbPath, stat.getVersion()); } catch (Exception e) { LOG.warn("Unable to delete our own bread-crumb of being active at " + zkBreadCrumbPath + ": " + e.getLocalizedMessage() + ". " + "Expecting to be fenced by the next active."); } }
/** * Try to delete the "ActiveBreadCrumb" node when gracefully giving up * active status. * If this fails, it will simply warn, since the graceful release behavior * is only an optimization. */ private void tryDeleteOwnBreadCrumbNode() { assert state == State.ACTIVE; LOG.info("Deleting bread-crumb of active node..."); // Sanity check the data. This shouldn't be strictly necessary, // but better to play it safe. Stat stat = new Stat(); byte[] data = null; try { data = zkClient.getData(zkBreadCrumbPath, false, stat); if (!Arrays.equals(data, appData)) { throw new IllegalStateException( "We thought we were active, but in fact " + "the active znode had the wrong data: " + StringUtils.byteToHexString(data) + " (stat=" + stat + ")"); } deleteWithRetries(zkBreadCrumbPath, stat.getVersion()); } catch (Exception e) { LOG.warn("Unable to delete our own bread-crumb of being active at " + zkBreadCrumbPath + ": " + e.getLocalizedMessage() + ". " + "Expecting to be fenced by the next active."); } }
/** * Try to delete the "ActiveBreadCrumb" node when gracefully giving up * active status. * If this fails, it will simply warn, since the graceful release behavior * is only an optimization. */ private void tryDeleteOwnBreadCrumbNode() { assert state == State.ACTIVE; LOG.info("Deleting bread-crumb of active node..."); // Sanity check the data. This shouldn't be strictly necessary, // but better to play it safe. Stat stat = new Stat(); byte[] data = null; try { data = zkClient.getData(zkBreadCrumbPath, false, stat); if (!Arrays.equals(data, appData)) { throw new IllegalStateException( "We thought we were active, but in fact " + "the active znode had the wrong data: " + StringUtils.byteToHexString(data) + " (stat=" + stat + ")"); } deleteWithRetries(zkBreadCrumbPath, stat.getVersion()); } catch (Exception e) { LOG.warn("Unable to delete our own bread-crumb of being active at " + zkBreadCrumbPath + ": " + e.getLocalizedMessage() + ". " + "Expecting to be fenced by the next active."); } }
/** * Try to delete the "ActiveBreadCrumb" node when gracefully giving up * active status. * If this fails, it will simply warn, since the graceful release behavior * is only an optimization. */ private void tryDeleteOwnBreadCrumbNode() { assert state == State.ACTIVE; LOG.info("Deleting bread-crumb of active node..."); // Sanity check the data. This shouldn't be strictly necessary, // but better to play it safe. Stat stat = new Stat(); byte[] data = null; try { data = zkClient.getData(zkBreadCrumbPath, false, stat); if (!Arrays.equals(data, appData)) { throw new IllegalStateException( "We thought we were active, but in fact " + "the active znode had the wrong data: " + StringUtils.byteToHexString(data) + " (stat=" + stat + ")"); } deleteWithRetries(zkBreadCrumbPath, stat.getVersion()); } catch (Exception e) { LOG.warn("Unable to delete our own bread-crumb of being active at " + zkBreadCrumbPath + ": " + e.getLocalizedMessage() + ". " + "Expecting to be fenced by the next active."); } }