diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/snapshot/SnapshotManager.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/snapshot/SnapshotManager.java index ae9b6fb0021..2b963b2c9fe 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/snapshot/SnapshotManager.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/snapshot/SnapshotManager.java @@ -27,6 +27,7 @@ import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.locks.ReadWriteLock; import java.util.concurrent.locks.ReentrantReadWriteLock; @@ -150,7 +151,7 @@ public class SnapshotManager extends MasterProcedureManager implements Stoppable // The map is always accessed and modified under the object lock using synchronized. // snapshotTable() will insert an Handler in the table. // isSnapshotDone() will remove the handler requested if the operation is finished. - private Map snapshotHandlers = new HashMap<>(); + private Map snapshotHandlers = new ConcurrentHashMap<>(); // Restore map, with table name as key, procedure ID as value. // The map is always accessed and modified under the object lock using synchronized. @@ -419,7 +420,7 @@ public class SnapshotManager extends MasterProcedureManager implements Stoppable * @param tableName name of the table being snapshotted. * @return true if there is a snapshot in progress on the specified table. */ - public synchronized boolean isTakingSnapshot(final TableName tableName) { + public boolean isTakingSnapshot(final TableName tableName) { SnapshotSentinel handler = this.snapshotHandlers.get(tableName); return handler != null && !handler.isFinished(); }