Skip to content

Commit 93a67de

Browse files
author
abhi
committed
bug 13473: fixed the concurrent access to vms hashmap
1 parent c6eb393 commit 93a67de

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

‎core/src/com/cloud/hypervisor/xen/resource/XenServerPoolVms.java‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
package com.cloud.hypervisor.xen.resource;
22

33
import java.util.HashMap;
4-
4+
import java.util.Map;
55
import org.apache.log4j.Logger;
6-
6+
import java.util.concurrent.ConcurrentHashMap;
77
import com.cloud.utils.Pair;
88
import com.cloud.vm.VirtualMachine.State;
99

1010

1111
public class XenServerPoolVms {
1212
private static final Logger s_logger = Logger.getLogger(XenServerPoolVms.class);
13-
private HashMap<String/* clusterId */, HashMap<String/* vm name */, Pair<String/* host uuid */, State/* vm state */>>> _cluster_vms =
14-
new HashMap<String, HashMap<String, Pair<String, State>>>();
13+
private final Map<String/* clusterId */, HashMap<String/* vm name */, Pair<String/* host uuid */, State/* vm state */>>> _cluster_vms =
14+
new ConcurrentHashMap<String, HashMap<String, Pair<String, State>>>();
15+
1516

1617
public HashMap<String, Pair<String, State>> getClusterVmState(String clusterId){
1718
HashMap<String, Pair<String, State>> _vms= _cluster_vms.get(clusterId);

0 commit comments

Comments
 (0)