Repository: cloudstack
Updated Branches:
  refs/heads/master b1d0df16c -> bd1752811


CID-1116250: Lock on s_appContextDelegates before calling get in 
ComponentContext

Signed-off-by: Rohit Yadav <[email protected]>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/bd175281
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/bd175281
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/bd175281

Branch: refs/heads/master
Commit: bd1752811c899d17e6a58bda782c5afd1c27ad6d
Parents: b1d0df1
Author: Rohit Yadav <[email protected]>
Authored: Thu Sep 18 11:52:18 2014 +0200
Committer: Rohit Yadav <[email protected]>
Committed: Thu Sep 18 11:52:18 2014 +0200

----------------------------------------------------------------------
 utils/src/com/cloud/utils/component/ComponentContext.java | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/bd175281/utils/src/com/cloud/utils/component/ComponentContext.java
----------------------------------------------------------------------
diff --git a/utils/src/com/cloud/utils/component/ComponentContext.java 
b/utils/src/com/cloud/utils/component/ComponentContext.java
index 7f9dc11..b041ecf 100644
--- a/utils/src/com/cloud/utils/component/ComponentContext.java
+++ b/utils/src/com/cloud/utils/component/ComponentContext.java
@@ -245,8 +245,10 @@ public class ComponentContext implements 
ApplicationContextAware {
     private static ApplicationContext getApplicationContext(Object instance) {
         ApplicationContext result = null;
 
-        if (instance != null && s_appContextDelegates != null) {
-            result = s_appContextDelegates.get(instance.getClass());
+        synchronized (s_appContextDelegates) {
+            if (instance != null && s_appContextDelegates != null) {
+                result = s_appContextDelegates.get(instance.getClass());
+            }
         }
 
         return result == null ? s_appContext : result;

Reply via email to