hadoop-yarn-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hong Zhiguo (JIRA)" <j...@apache.org>
Subject [jira] [Created] (YARN-2761) potential race condition in SchedulingPolicy
Date Tue, 28 Oct 2014 03:37:33 GMT
Hong Zhiguo created YARN-2761:
---------------------------------

             Summary: potential race condition in SchedulingPolicy
                 Key: YARN-2761
                 URL: https://issues.apache.org/jira/browse/YARN-2761
             Project: Hadoop YARN
          Issue Type: Bug
          Components: fairscheduler
            Reporter: Hong Zhiguo
            Assignee: Hong Zhiguo
            Priority: Minor


reported by findbug. 
In SchedulingPolicy.getInstance, ConcurrentHashMap.get and ConcurrentHashMap.put is called.
These two operations together should be atomic, but using ConcurrentHashMap doesn't guarantee
this. 
{code} 
public static SchedulingPolicy getInstance(Class<? extends  SchedulingPolicy> clazz)
{ 
  SchedulingPolicy policy = instances.get(clazz); 
  if (policy == null) { 
    policy = ReflectionUtils.newInstance(clazz, null); 
   instances.put(clazz, policy); 
  } 
  return policy; 
} 
{code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message