You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by ud...@apache.org on 2015/04/10 13:39:40 UTC

[1/2] stratos git commit: fixing possible bugs, NPE, lock issue

Repository: stratos
Updated Branches:
  refs/heads/master 97c1b5e6a -> 67d17ad3a


fixing possible bugs, NPE, lock issue


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

Branch: refs/heads/master
Commit: 67d17ad3ad981e09193c4cd27fe682c929853895
Parents: 9a08abd
Author: Udara Liyanage <ud...@wso2.com>
Authored: Fri Apr 10 15:52:17 2015 +0530
Committer: Udara Liyanage <ud...@wso2.com>
Committed: Fri Apr 10 17:09:23 2015 +0530

----------------------------------------------------------------------
 .../event/publisher/ClusterStatusEventPublisher.java        | 4 ++--
 .../apache/stratos/cloud/controller/iaases/JcloudsIaas.java | 5 +++++
 .../ApplicationClustersRemovedMessageProcessor.java         | 9 +++++----
 3 files changed, 12 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/67d17ad3/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/event/publisher/ClusterStatusEventPublisher.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/event/publisher/ClusterStatusEventPublisher.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/event/publisher/ClusterStatusEventPublisher.java
index c6ec135..6998646 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/event/publisher/ClusterStatusEventPublisher.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/event/publisher/ClusterStatusEventPublisher.java
@@ -212,7 +212,7 @@ public class ClusterStatusEventPublisher {
     public static void sendClusterTerminatedEvent(String appId, String serviceName,
                                                   String clusterId, String instanceId) {
         try {
-            TopologyManager.acquireReadLockForCluster(serviceName, clusterId);
+            //TopologyManager.acquireReadLockForCluster(serviceName, clusterId);
             Service service = TopologyManager.getTopology().getService(serviceName);
             if (service != null) {
                 Cluster cluster = service.getCluster(clusterId);
@@ -240,7 +240,7 @@ public class ClusterStatusEventPublisher {
                 }
             }
         } finally {
-            TopologyManager.releaseReadLockForCluster(serviceName, clusterId);
+            //TopologyManager.releaseReadLockForCluster(serviceName, clusterId);
 
         }
     }

http://git-wip-us.apache.org/repos/asf/stratos/blob/67d17ad3/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/JcloudsIaas.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/JcloudsIaas.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/JcloudsIaas.java
index 4da8bf2..b374a84 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/JcloudsIaas.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/JcloudsIaas.java
@@ -349,6 +349,11 @@ public abstract class JcloudsIaas extends Iaas {
     private void detachVolume(MemberContext ctxt) {
         String clusterId = ctxt.getClusterId();
         ClusterContext clusterContext = CloudControllerContext.getInstance().getClusterContext(clusterId);
+        if(clusterContext == null){
+            log.error(String.format("Could not detach volume, Cluster context not found for the [member] %s [cluster-id]", ctxt.getMemberId(), clusterId));
+            return;
+        }
+
         if (clusterContext.getVolumes() != null) {
             for (Volume volume : clusterContext.getVolumes()) {
                 try {

http://git-wip-us.apache.org/repos/asf/stratos/blob/67d17ad3/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/ApplicationClustersRemovedMessageProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/ApplicationClustersRemovedMessageProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/ApplicationClustersRemovedMessageProcessor.java
index fa81fd9..6c7f45a 100644
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/ApplicationClustersRemovedMessageProcessor.java
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/ApplicationClustersRemovedMessageProcessor.java
@@ -72,10 +72,11 @@ public class ApplicationClustersRemovedMessageProcessor extends MessageProcessor
         Set<ClusterDataHolder> clusterData = event.getClusterData();
         if (clusterData != null) {
             for (ClusterDataHolder aClusterData : clusterData) {
-                TopologyUpdater.acquireWriteLockForService(aClusterData.getServiceType());
+                String serviceType = aClusterData.getServiceType();
+                TopologyUpdater.acquireWriteLockForService(serviceType);
 
                 try {
-                    Service aService = topology.getService(aClusterData.getServiceType());
+                    Service aService = topology.getService(serviceType);
                     if (aService != null) {
                         if (aService.clusterExists(aClusterData.getClusterId())) {
                             aService.removeCluster(aClusterData.getClusterId());
@@ -87,11 +88,11 @@ public class ApplicationClustersRemovedMessageProcessor extends MessageProcessor
                             }
                         }
                     } else {
-                        log.warn("Service " + aClusterData.getServiceType() + " not found, unable to remove Cluster " + aClusterData.getClusterId());
+                        log.warn("Service " + serviceType + " not found, unable to remove Cluster " + aClusterData.getClusterId());
                     }
 
                 } finally {
-                    TopologyUpdater.releaseWriteLockForService(aClusterData.getServiceType());
+                    TopologyUpdater.releaseWriteLockForService(serviceType);
                 }
             }
 


[2/2] stratos git commit: removing unncesarry lock removal which solves application redployment issue

Posted by ud...@apache.org.
removing unncesarry lock removal which solves application redployment issue


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

Branch: refs/heads/master
Commit: 9a08abde0a9f3720b0345ee53612d05f06845602
Parents: 97c1b5e
Author: Udara Liyanage <ud...@wso2.com>
Authored: Fri Apr 10 14:24:22 2015 +0530
Committer: Udara Liyanage <ud...@wso2.com>
Committed: Fri Apr 10 17:09:23 2015 +0530

----------------------------------------------------------------------
 .../java/org/apache/stratos/messaging/domain/topology/Topology.java | 1 -
 1 file changed, 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/9a08abde/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/Topology.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/Topology.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/Topology.java
index 86739d4..3923d0e 100644
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/Topology.java
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/Topology.java
@@ -83,7 +83,6 @@ public class Topology implements Serializable {
 
     public void removeFromClusterMap(String cluserId){
         clusterMap.remove(cluserId);
-        TopologyLockHierarchy.getInstance().removeTopologyLockForCluster(cluserId);
     }
 
     public Cluster getCluster(String clusterId){