ctubbsii commented on code in PR #6470:
URL: https://github.com/apache/accumulo/pull/6470#discussion_r3554138798
##########
core/src/main/java/org/apache/accumulo/core/clientImpl/ClientContext.java:
##########
@@ -631,51 +631,63 @@ private synchronized TableZooHelper tableZooHelper() {
}
public TableId getTableId(String tableName) throws TableNotFoundException {
+ ensureOpen();
return tableZooHelper().getTableId(tableName);
}
public TableId _getTableIdDetectNamespaceNotFound(String tableName)
throws NamespaceNotFoundException, TableNotFoundException {
+ ensureOpen();
return tableZooHelper()._getTableIdDetectNamespaceNotFound(tableName);
}
public String getTableName(TableId tableId) throws TableNotFoundException {
+ ensureOpen();
return tableZooHelper().getTableName(tableId);
}
public Map<String,TableId> getTableNameToIdMap() {
+ ensureOpen();
return tableZooHelper().getTableMap().getNameToIdMap();
}
public Map<TableId,String> getTableIdToNameMap() {
+ ensureOpen();
return tableZooHelper().getTableMap().getIdtoNameMap();
}
public boolean tableNodeExists(TableId tableId) {
+ ensureOpen();
return tableZooHelper().tableNodeExists(tableId);
}
public void clearTableListCache() {
+ ensureOpen();
tableZooHelper().clearTableListCache();
}
public String getPrintableTableInfoFromId(TableId tableId) {
+ ensureOpen();
return tableZooHelper().getPrintableTableInfoFromId(tableId);
}
public String getPrintableTableInfoFromName(String tableName) {
+ ensureOpen();
return tableZooHelper().getPrintableTableInfoFromName(tableName);
}
public TableState getTableState(TableId tableId) {
+ ensureOpen();
return tableZooHelper().getTableState(tableId, false);
}
public TableState getTableState(TableId tableId, boolean clearCachedState) {
+ ensureOpen();
return tableZooHelper().getTableState(tableId, clearCachedState);
}
public NamespaceId getNamespaceId(TableId tableId) throws
TableNotFoundException {
+ ensureOpen();
Review Comment:
Oh, I didn't realize that this was attempting to check before the
synchronized block. However, I think that tableZooHelper doesn't need to
synchronize on the same object monitor. It appears to only be synchronized for
lazy construction, but synchronizing on any other object monitor would suffice
for that. Or, it could be a memoized supplier set up in the constructor, and
then that method can have its synchronized keyword removed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]