cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kelv...@apache.org
Subject [02/27] git commit: updated refs/heads/master to ae23144
Date Wed, 04 Sep 2013 22:42:11 GMT
Correct DAO usage in VmwareDatacenterVO, relax assertion conditions to work with stack calling
frame that is not wrapped with @DB injection


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

Branch: refs/heads/master
Commit: 249e2e8f59c6e88d9ce83d16c2d2d1516a656b51
Parents: 57dc52b
Author: Kelven Yang <kelveny@gmail.com>
Authored: Tue Jul 30 18:05:01 2013 -0700
Committer: Kelven Yang <kelveny@gmail.com>
Committed: Wed Sep 4 14:49:44 2013 -0700

----------------------------------------------------------------------
 engine/schema/src/com/cloud/upgrade/dao/VersionDaoImpl.java | 1 +
 framework/db/src/com/cloud/utils/db/Transaction.java        | 8 +++++++-
 .../src/com/cloud/hypervisor/vmware/VmwareDatacenterVO.java | 8 ++++----
 server/src/com/cloud/servlet/CloudStartupServlet.java       | 9 ++++++++-
 4 files changed, 20 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/249e2e8f/engine/schema/src/com/cloud/upgrade/dao/VersionDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/upgrade/dao/VersionDaoImpl.java b/engine/schema/src/com/cloud/upgrade/dao/VersionDaoImpl.java
index 7c5c9cc..3b2ed7e 100644
--- a/engine/schema/src/com/cloud/upgrade/dao/VersionDaoImpl.java
+++ b/engine/schema/src/com/cloud/upgrade/dao/VersionDaoImpl.java
@@ -73,6 +73,7 @@ public class VersionDaoImpl extends GenericDaoBase<VersionVO, Long>
implements V
     }
 
     @Override
+    @DB
     public String getCurrentVersion() {
         Connection conn = null;
         try {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/249e2e8f/framework/db/src/com/cloud/utils/db/Transaction.java
----------------------------------------------------------------------
diff --git a/framework/db/src/com/cloud/utils/db/Transaction.java b/framework/db/src/com/cloud/utils/db/Transaction.java
index 37ea8cf..a5da4b3 100755
--- a/framework/db/src/com/cloud/utils/db/Transaction.java
+++ b/framework/db/src/com/cloud/utils/db/Transaction.java
@@ -299,13 +299,19 @@ public class Transaction {
         if (se == null) {
             return false;
         }
+        
+        StringBuffer sb = new StringBuffer();
         for (; stack < stacks.length; stack++) {
             String methodName = stacks[stack].getMethodName();
+            sb.append(" ").append(methodName);
             if (methodName.equals(se.ref)){
                 return true;
             }
         }
-        return false;
+        
+        // relax stack structure for several places that @DB required injection is not in
place
+        s_logger.warn("Non-standard stack context that Transaction context is manaully placed
into the calling chain. Stack chain: " + sb);
+        return true;
     }
 
     protected static String buildName() {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/249e2e8f/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareDatacenterVO.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareDatacenterVO.java
b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareDatacenterVO.java
index 4a2c4e9..b615012 100644
--- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareDatacenterVO.java
+++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareDatacenterVO.java
@@ -49,7 +49,7 @@ public class VmwareDatacenterVO implements VmwareDatacenter {
     private String vmwareDatacenterName;
 
     @Column(name = "vcenter_host")
-    private String vCenterHost;
+    private String vcenterHost;
 
     @Column(name = "uuid")
     private String uuid;
@@ -93,7 +93,7 @@ public class VmwareDatacenterVO implements VmwareDatacenter {
 
     @Override
     public String getVcenterHost() {
-        return vCenterHost;
+        return vcenterHost;
     }
 
     public void setUuid(String uuid) {
@@ -109,7 +109,7 @@ public class VmwareDatacenterVO implements VmwareDatacenter {
     }
 
     public void setVcenterHost(String vCenterHost) {
-        this.vCenterHost = vCenterHost;
+        this.vcenterHost = vCenterHost;
     }
 
     public void setUser(String user) {
@@ -143,7 +143,7 @@ public class VmwareDatacenterVO implements VmwareDatacenter {
         this.uuid = UUID.randomUUID().toString();
         this.vmwareDatacenterName = name;
         this.guid = guid;
-        this.vCenterHost = vCenterHost;
+        this.vcenterHost = vCenterHost;
         this.user = user;
         this.password = password;
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/249e2e8f/server/src/com/cloud/servlet/CloudStartupServlet.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/servlet/CloudStartupServlet.java b/server/src/com/cloud/servlet/CloudStartupServlet.java
index 2cabe15..8fbae92 100755
--- a/server/src/com/cloud/servlet/CloudStartupServlet.java
+++ b/server/src/com/cloud/servlet/CloudStartupServlet.java
@@ -29,6 +29,7 @@ import org.springframework.web.context.support.SpringBeanAutowiringSupport;
 import com.cloud.utils.LogUtils;
 import com.cloud.utils.SerialVersionUID;
 import com.cloud.utils.component.ComponentContext;
+import com.cloud.utils.db.Transaction;
 
 public class CloudStartupServlet extends HttpServlet {
     public static final Logger s_logger = Logger.getLogger(CloudStartupServlet.class.getName());
@@ -47,7 +48,13 @@ public class CloudStartupServlet extends HttpServlet {
 			public void run() {
 				if(ComponentContext.getApplicationContext() != null) {
 					_timer.cancel();
-					ComponentContext.initComponentsLifeCycle();
+					
+					Transaction txn = Transaction.open(Transaction.CLOUD_DB);
+					try {
+						ComponentContext.initComponentsLifeCycle();
+					} finally {
+						txn.close();
+					}
 				}
 			}
     	}, 0, 1000);


Mime
View raw message