in tagCommand, AsyncJobExecutionContext doesn't need to be created if it 
doesn't exist


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

Branch: refs/heads/master
Commit: e5a91e40dda8e8ecf02efbd8bf1c9f5c14f2b257
Parents: f1f61e1
Author: Anthony Xu <[email protected]>
Authored: Wed Sep 17 17:55:56 2014 -0700
Committer: Anthony Xu <[email protected]>
Committed: Wed Sep 17 18:15:41 2014 -0700

----------------------------------------------------------------------
 .../src/com/cloud/agent/manager/AgentManagerImpl.java           | 2 +-
 .../cloudstack/framework/jobs/AsyncJobExecutionContext.java     | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e5a91e40/engine/orchestration/src/com/cloud/agent/manager/AgentManagerImpl.java
----------------------------------------------------------------------
diff --git 
a/engine/orchestration/src/com/cloud/agent/manager/AgentManagerImpl.java 
b/engine/orchestration/src/com/cloud/agent/manager/AgentManagerImpl.java
index 2d5eb2b..9e8e026 100755
--- a/engine/orchestration/src/com/cloud/agent/manager/AgentManagerImpl.java
+++ b/engine/orchestration/src/com/cloud/agent/manager/AgentManagerImpl.java
@@ -380,7 +380,7 @@ public class AgentManagerImpl extends ManagerBase 
implements AgentManager, Handl
     }
 
     private static void tagCommand(Command cmd) {
-        AsyncJobExecutionContext context = 
AsyncJobExecutionContext.getCurrentExecutionContext();
+        AsyncJobExecutionContext context = 
AsyncJobExecutionContext.getCurrent();
         if (context != null && context.getJob() != null) {
             AsyncJob job = context.getJob();
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e5a91e40/framework/jobs/src/org/apache/cloudstack/framework/jobs/AsyncJobExecutionContext.java
----------------------------------------------------------------------
diff --git 
a/framework/jobs/src/org/apache/cloudstack/framework/jobs/AsyncJobExecutionContext.java
 
b/framework/jobs/src/org/apache/cloudstack/framework/jobs/AsyncJobExecutionContext.java
index 86c6542..5575ab3 100644
--- 
a/framework/jobs/src/org/apache/cloudstack/framework/jobs/AsyncJobExecutionContext.java
+++ 
b/framework/jobs/src/org/apache/cloudstack/framework/jobs/AsyncJobExecutionContext.java
@@ -182,6 +182,11 @@ public class AsyncJobExecutionContext  {
         return context;
     }
 
+    // return currentExecutionContext without create it
+    public static AsyncJobExecutionContext getCurrent() {
+        return s_currentExectionContext.get();
+    }
+
     public static AsyncJobExecutionContext registerPseudoExecutionContext(long 
accountId, long userId) {
         AsyncJobExecutionContext context = s_currentExectionContext.get();
         if (context == null) {

Reply via email to