protected void releaseTable(final String catalogPath) {
synchronized (this.apiSync) {
final Geodatabase geodatabase = getGeodatabase();
if (geodatabase != null) {
try {
final Table table = this.tableByCatalogPath.get(catalogPath);
if (table != null) {
final Integer count = Maps.decrementCount(this.tableReferenceCountsByCatalogPath,
catalogPath);
if (count == 0) {
try {
this.tableByCatalogPath.remove(catalogPath);
this.tableWriteLockCountsByCatalogPath.remove(catalogPath);
geodatabase.closeTable(table);
} catch (final Exception e) {
Logs.error(this, "Unable to close table: " + catalogPath, e);
} finally {
if (this.tableByCatalogPath.isEmpty()) {
this.geodatabaseReferenceCount--;
}
table.delete();
}
}
}
} finally {
releaseGeodatabase();
}
}
}
}