HBASE-10745 Access ShutdownHook#fsShutdownHooks should be synchronized

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1577588 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
jxiang 2014-03-14 15:56:43 +00:00
parent 47e3864ee0
commit 221bd54ba2
1 changed files with 5 additions and 5 deletions

View File

@ -198,12 +198,12 @@ public class ShutdownHook {
if (hdfsClientFinalizer == null) {
throw new RuntimeException("Client finalizer is null, can't suppress!");
}
synchronized (fsShutdownHooks) {
if (!fsShutdownHooks.containsKey(hdfsClientFinalizer) &&
!ShutdownHookManager.deleteShutdownHook(hdfsClientFinalizer)) {
throw new RuntimeException("Failed suppression of fs shutdown hook: " +
hdfsClientFinalizer);
}
synchronized (fsShutdownHooks) {
Integer refs = fsShutdownHooks.get(hdfsClientFinalizer);
fsShutdownHooks.put(hdfsClientFinalizer, refs == null ? 1 : refs + 1);
}