Class TableZooHelper
- java.lang.Object
-
- org.apache.accumulo.core.util.tables.TableZooHelper
-
- All Implemented Interfaces:
AutoCloseable
public class TableZooHelper extends Object implements AutoCloseable
-
-
Constructor Summary
Constructors Constructor Description TableZooHelper(ClientContext context)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TableId
_getTableIdDetectNamespaceNotFound(String tableName)
Lookup table ID in ZK.void
clearTableListCache()
void
close()
NamespaceId
getNamespaceId(TableId tableId)
Returns the namespace id for a given table ID.String
getPrintableTableInfoFromId(TableId tableId)
String
getPrintableTableInfoFromName(String tableName)
TableId
getTableId(String tableName)
Lookup table ID in ZK.TableMap
getTableMap()
Get the TableMap from the cache.String
getTableName(TableId tableId)
TableState
getTableState(TableId tableId, boolean clearCachedState)
Get the current state of the table using the tableid.boolean
tableNodeExists(TableId tableId)
-
-
-
Constructor Detail
-
TableZooHelper
public TableZooHelper(ClientContext context)
-
-
Method Detail
-
getTableId
public TableId getTableId(String tableName) throws TableNotFoundException
Lookup table ID in ZK.- Throws:
TableNotFoundException
- if not found; if the namespace was not found, this has a getCause() of NamespaceNotFoundException
-
_getTableIdDetectNamespaceNotFound
public TableId _getTableIdDetectNamespaceNotFound(String tableName) throws NamespaceNotFoundException, TableNotFoundException
Lookup table ID in ZK. If not found, clears cache and tries again.
-
getTableName
public String getTableName(TableId tableId) throws TableNotFoundException
- Throws:
TableNotFoundException
-
getTableMap
public TableMap getTableMap()
Get the TableMap from the cache. A new one will be populated when needed. Cache is cleared manually by callingclearTableListCache()
-
tableNodeExists
public boolean tableNodeExists(TableId tableId)
-
clearTableListCache
public void clearTableListCache()
-
getTableState
public TableState getTableState(TableId tableId, boolean clearCachedState)
Get the current state of the table using the tableid. The boolean clearCache, if true will clear the table state in zookeeper before fetching the state. Added with ACCUMULO-4574.- Parameters:
tableId
- the table idclearCachedState
- if true clear the table state in zookeeper before checking status- Returns:
- the table state.
-
getNamespaceId
public NamespaceId getNamespaceId(TableId tableId) throws TableNotFoundException
Returns the namespace id for a given table ID.- Parameters:
tableId
- The tableId- Returns:
- The namespace id which this table resides in.
- Throws:
IllegalArgumentException
- if the table doesn't exist in ZooKeeperTableNotFoundException
-
close
public void close()
- Specified by:
close
in interfaceAutoCloseable
-
-