private boolean isTableState(final String tableName, final ZooKeeperProtos.Table.State state) { synchronized (this.cache) { ZooKeeperProtos.Table.State currentState = this.cache.get(tableName); return ZKTableReadOnly.isTableState(currentState, state); } }
/** * Go to zookeeper and see if state of table is {@link org.apache.hadoop.hbase.zookeeper.ZKTable.TableState#DISABLING} * of {@link org.apache.hadoop.hbase.zookeeper.ZKTable.TableState#DISABLED}. This method does not use cache as * {@link #isEnabledTable(String)} does. This method is for clients other than * {@link org.apache.hadoop.hbase.master.AssignmentManager}. * * @param zkw * @param tableName * @return True if table is enabled. * @throws org.apache.zookeeper.KeeperException */ public static boolean isDisablingOrDisabledTable(final ZooKeeperWatcher zkw, final String tableName) throws KeeperException { ZooKeeperProtos.Table.State state = getTableState(zkw, tableName); return isTableState(ZooKeeperProtos.Table.State.DISABLING, state) || isTableState(ZooKeeperProtos.Table.State.DISABLED, state); }
/** * Go to zookeeper and see if state of table is {@link org.apache.hadoop.hbase.zookeeper.ZKTable.TableState#DISABLED}. * This method does not use cache as {@link #isDisabledTable(String)} does. * This method is for clients other than {@link org.apache.hadoop.hbase.master.AssignmentManager} * * @param zkw * @param tableName * @return True if table is enabled. * @throws org.apache.zookeeper.KeeperException */ public static boolean isDisabledTable(final ZooKeeperWatcher zkw, final String tableName) throws KeeperException { ZooKeeperProtos.Table.State state = getTableState(zkw, tableName); return isTableState(ZooKeeperProtos.Table.State.DISABLED, state); }