/** * Sets the ENABLED state in the cache and creates or force updates a node to * ENABLED state for the specified table * * @param tableName * @throws org.apache.zookeeper.KeeperException */ public void setEnabledTable(final String tableName) throws KeeperException { setTableState(tableName, ZooKeeperProtos.Table.State.ENABLED); }
/** * Sets the specified table as ENABLING in zookeeper. Fails silently if the * table is already disabled in zookeeper. Sets no watches. * * @param tableName * @throws org.apache.zookeeper.KeeperException * unexpected zookeeper exception */ public void setEnablingTable(final String tableName) throws KeeperException { synchronized (this.cache) { if (!isDisabledOrEnablingTable(tableName)) { LOG.warn("Moving table " + tableName + " state to enabling but was " + "not first in disabled state: " + this.cache.get(tableName)); } setTableState(tableName, ZooKeeperProtos.Table.State.ENABLING); } }
/** * Sets the specified table as DISABLED in zookeeper. Fails silently if the * table is already disabled in zookeeper. Sets no watches. * * @param tableName * @throws org.apache.zookeeper.KeeperException * unexpected zookeeper exception */ public void setDisabledTable(String tableName) throws KeeperException { synchronized (this.cache) { if (!isDisablingOrDisabledTable(tableName)) { LOG.warn("Moving table " + tableName + " state to disabled but was " + "not first in disabling state: " + this.cache.get(tableName)); } setTableState(tableName, ZooKeeperProtos.Table.State.DISABLED); } }
/** * Sets the specified table as DISABLING in zookeeper. Fails silently if the * table is already disabled in zookeeper. Sets no watches. * * @param tableName * @throws org.apache.zookeeper.KeeperException * unexpected zookeeper exception */ public void setDisablingTable(final String tableName) throws KeeperException { synchronized (this.cache) { if (!isEnabledOrDisablingTable(tableName)) { LOG.warn("Moving table " + tableName + " state to disabling but was " + "not first in enabled state: " + this.cache.get(tableName)); } setTableState(tableName, ZooKeeperProtos.Table.State.DISABLING); } }
/** * Sets the specified table as ENABLING in zookeeper atomically If the table * is already in ENABLING state, no operation is performed * * @param tableName * @return if the operation succeeds or not * @throws org.apache.zookeeper.KeeperException * unexpected zookeeper exception */ public boolean checkAndSetEnablingTable(final String tableName) throws KeeperException { synchronized (this.cache) { if (isEnablingTable(tableName)) { return false; } setTableState(tableName, ZooKeeperProtos.Table.State.ENABLING); return true; } }
/** * Sets the specified table as ENABLING in zookeeper atomically If the table * isn't in DISABLED state, no operation is performed * * @param tableName * @return if the operation succeeds or not * @throws org.apache.zookeeper.KeeperException * unexpected zookeeper exception */ public boolean checkDisabledAndSetEnablingTable(final String tableName) throws KeeperException { synchronized (this.cache) { if (!isDisabledTable(tableName)) { return false; } setTableState(tableName, ZooKeeperProtos.Table.State.ENABLING); return true; } }
/** * Sets the specified table as DISABLING in zookeeper atomically If the table * isn't in ENABLED state, no operation is performed * * @param tableName * @return if the operation succeeds or not * @throws org.apache.zookeeper.KeeperException * unexpected zookeeper exception */ public boolean checkEnabledAndSetDisablingTable(final String tableName) throws KeeperException { synchronized (this.cache) { if (this.cache.get(tableName) != null && !isEnabledTable(tableName)) { return false; } setTableState(tableName, ZooKeeperProtos.Table.State.DISABLING); return true; } }