Updated Branches: refs/heads/4.0 6350e957a -> 2862774c6
Commit for https://reviews.apache.org/r/7191/ Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/2862774c Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/2862774c Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/2862774c Branch: refs/heads/4.0 Commit: 2862774c60882a7e4858ca598fc8673e6393f91f Parents: 76df992 Author: Kelven Yang <[email protected]> Authored: Thu Sep 20 15:46:04 2012 -0700 Committer: Kelven Yang <[email protected]> Committed: Thu Sep 20 17:10:51 2012 -0700 ---------------------------------------------------------------------- .../VmwareSecondaryStorageContextFactory.java | 10 ++++++---- 1 files changed, 6 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/2862774c/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareSecondaryStorageContextFactory.java ---------------------------------------------------------------------- diff --git a/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareSecondaryStorageContextFactory.java b/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareSecondaryStorageContextFactory.java index fce66a9..fc298c8 100644 --- a/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareSecondaryStorageContextFactory.java +++ b/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareSecondaryStorageContextFactory.java @@ -17,6 +17,7 @@ package com.cloud.storage.resource; import java.util.HashMap; +import java.util.Iterator; import java.util.Map; import com.cloud.hypervisor.vmware.util.VmwareContext; @@ -60,10 +61,11 @@ public class VmwareSecondaryStorageContextFactory { public static void invalidate(VmwareContext context) { synchronized(s_contextMap) { - for(Map.Entry<String, VmwareContext> entry : s_contextMap.entrySet()) { - if(entry.getValue() == context) { - s_contextMap.remove(entry.getKey()); - } + for(Iterator<Map.Entry<String, VmwareContext>> entryIter = s_contextMap.entrySet().iterator(); entryIter.hasNext();) { + Map.Entry<String, VmwareContext> entry = entryIter.next(); + if(entry.getValue() == context) { + entryIter.remove(); + } } }
