bug 13473: fixed the concurrent access to vms hashmap

This commit is contained in:
abhi 2012-02-07 07:59:22 +05:30
parent c6eb393f5c
commit 93a67de978
1 changed files with 5 additions and 4 deletions

View File

@ -1,17 +1,18 @@
package com.cloud.hypervisor.xen.resource;
import java.util.HashMap;
import java.util.Map;
import org.apache.log4j.Logger;
import java.util.concurrent.ConcurrentHashMap;
import com.cloud.utils.Pair;
import com.cloud.vm.VirtualMachine.State;
public class XenServerPoolVms {
private static final Logger s_logger = Logger.getLogger(XenServerPoolVms.class);
private HashMap<String/* clusterId */, HashMap<String/* vm name */, Pair<String/* host uuid */, State/* vm state */>>> _cluster_vms =
new HashMap<String, HashMap<String, Pair<String, State>>>();
private final Map<String/* clusterId */, HashMap<String/* vm name */, Pair<String/* host uuid */, State/* vm state */>>> _cluster_vms =
new ConcurrentHashMap<String, HashMap<String, Pair<String, State>>>();
public HashMap<String, Pair<String, State>> getClusterVmState(String clusterId){
HashMap<String, Pair<String, State>> _vms= _cluster_vms.get(clusterId);