cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kelv...@apache.org
Subject [03/27] git commit: updated refs/heads/master to ae23144
Date Wed, 04 Sep 2013 22:42:12 GMT
CLOUDSTACK-4357: don't cache ServiceContent and rootFolder in memory, the cache semantics break
session keep-alive mechanism


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

Branch: refs/heads/master
Commit: b4a7d2031990c3c2e326efcd1bed8a7c5079ad3c
Parents: 899f92b
Author: Kelven Yang <kelveny@gmail.com>
Authored: Sat Aug 17 23:06:42 2013 -0700
Committer: Kelven Yang <kelveny@gmail.com>
Committed: Wed Sep 4 14:49:45 2013 -0700

----------------------------------------------------------------------
 .../cloud/hypervisor/vmware/util/VmwareClient.java  | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b4a7d203/vmware-base/src/com/cloud/hypervisor/vmware/util/VmwareClient.java
----------------------------------------------------------------------
diff --git a/vmware-base/src/com/cloud/hypervisor/vmware/util/VmwareClient.java b/vmware-base/src/com/cloud/hypervisor/vmware/util/VmwareClient.java
index c822265..d4e4256 100644
--- a/vmware-base/src/com/cloud/hypervisor/vmware/util/VmwareClient.java
+++ b/vmware-base/src/com/cloud/hypervisor/vmware/util/VmwareClient.java
@@ -108,10 +108,8 @@ public class VmwareClient {
 
     private ManagedObjectReference SVC_INST_REF = new ManagedObjectReference();
     private ManagedObjectReference propCollectorRef;
-    private ManagedObjectReference rootRef;
     private static VimService vimService;
     private VimPortType vimPort;
-    private ServiceContent serviceContent;
     private String serviceCookie;
     private final String SVC_INST_NAME = "ServiceInstance";
 
@@ -139,7 +137,7 @@ public class VmwareClient {
         ctxt.put("com.sun.xml.internal.ws.request.timeout", 600000);
         ctxt.put("com.sun.xml.internal.ws.connect.timeout", 600000);
 
-        serviceContent = vimPort.retrieveServiceContent(SVC_INST_REF);
+        ServiceContent serviceContent = vimPort.retrieveServiceContent(SVC_INST_REF);
 
         // Extract a cookie. See vmware sample program com.vmware.httpfileaccess.GetVMFiles
         Map<String, List<String>> headers = (Map<String, List<String>>)
((BindingProvider) vimPort)
@@ -155,7 +153,6 @@ public class VmwareClient {
         isConnected = true;
 
         propCollectorRef = serviceContent.getPropertyCollector();
-        rootRef = serviceContent.getRootFolder();
     }
 
     /**
@@ -165,7 +162,7 @@ public class VmwareClient {
      */
     public void disconnect() throws Exception {
         if (isConnected) {
-            vimPort.logout(serviceContent.getSessionManager());
+            vimPort.logout(getServiceContent().getSessionManager());
         }
         isConnected = false;
     }
@@ -181,7 +178,12 @@ public class VmwareClient {
      * @return Service instance content
      */
     public ServiceContent getServiceContent() {
-        return serviceContent;
+    	
+        try {
+			return vimPort.retrieveServiceContent(SVC_INST_REF);
+		} catch (RuntimeFaultFaultMsg e) {
+		}
+        return null;
     }
 
     /**
@@ -202,7 +204,7 @@ public class VmwareClient {
      * @return Root folder
      */
     public ManagedObjectReference getRootFolder() {
-        return rootRef;
+        return getServiceContent().getRootFolder();
     }
 
     /**


Mime
View raw message