@Override
    public List<HivePartitionName> refreshTable(String hiveDbName, String hiveTblName,
                                                boolean onlyCachedPartitions) {
        DatabaseTableName databaseTableName = DatabaseTableName.of(hiveDbName, hiveTblName);
        tableNameLockMap.putIfAbsent(databaseTableName, hiveDbName + "_" + hiveTblName + "_lock");
        String lockStr = tableNameLockMap.get(databaseTableName);
        synchronized (lockStr) {
            return refreshTableWithoutSync(hiveDbName, hiveTblName, databaseTableName, onlyCachedPartitions);
        }
    }
@Test
    public void testRefreshTableSync() {
        CachingHiveMetastore cachingHiveMetastore = new CachingHiveMetastore(
                metastore, executor, expireAfterWriteSec, refreshAfterWriteSec, 1000, false);
        Assert.assertFalse(cachingHiveMetastore.tableNameLockMap.containsKey(
                DatabaseTableName.of("db1", "tbl1")));
        try {
            cachingHiveMetastore.refreshTable("db1", "tbl1", true);
        } catch (Exception e) {
            Assert.fail();
        }
        Assert.assertTrue(cachingHiveMetastore.tableNameLockMap.containsKey(
                DatabaseTableName.of("db1", "tbl1")));

        try {
            cachingHiveMetastore.refreshTable("db1", "tbl1", true);
        } catch (Exception e) {
            Assert.fail();
        }

        Assert.assertEquals(1, cachingHiveMetastore.tableNameLockMap.size());
    }