incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stefane...@apache.org
Subject svn commit: r1489455 - in /sling/trunk/bundles/extensions/discovery/impl/src/main/java/org/apache/sling/discovery/impl: DiscoveryServiceImpl.java common/heartbeat/HeartbeatHandler.java
Date Tue, 04 Jun 2013 14:23:00 GMT
Author: stefanegli
Date: Tue Jun  4 14:22:52 2013
New Revision: 1489455

URL: http://svn.apache.org/r1489455
Log:
SLING-2901 : robust paranoia check on duplicate sling.id : sending a TOPOLOGY_CHANGING before
stopping the discovery.impl bundle

Modified:
    sling/trunk/bundles/extensions/discovery/impl/src/main/java/org/apache/sling/discovery/impl/DiscoveryServiceImpl.java
    sling/trunk/bundles/extensions/discovery/impl/src/main/java/org/apache/sling/discovery/impl/common/heartbeat/HeartbeatHandler.java

Modified: sling/trunk/bundles/extensions/discovery/impl/src/main/java/org/apache/sling/discovery/impl/DiscoveryServiceImpl.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/discovery/impl/src/main/java/org/apache/sling/discovery/impl/DiscoveryServiceImpl.java?rev=1489455&r1=1489454&r2=1489455&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/discovery/impl/src/main/java/org/apache/sling/discovery/impl/DiscoveryServiceImpl.java
(original)
+++ sling/trunk/bundles/extensions/discovery/impl/src/main/java/org/apache/sling/discovery/impl/DiscoveryServiceImpl.java
Tue Jun  4 14:22:52 2013
@@ -637,4 +637,26 @@ public class DiscoveryServiceImpl implem
         }
     }
 
+    /** SLING-2901 : send a TOPOLOGY_CHANGING event and shutdown the service thereafter **/
+	public void forcedShutdown() {
+		synchronized(lock) {
+	        if (!activated) {
+	            logger.error("forcedShutdown: ignoring forced shutdown. Service is not activated.");
+	            return;
+	        }
+	        if (oldView == null) {
+	            logger.error("forcedShutdown: ignoring forced shutdown. No oldView available.");
+	            return;
+	        }
+	        logger.error("forcedShutdown: sending TOPOLOGY_CHANGING to all listeners");
+            for (final TopologyEventListener da : eventListeners) {
+                sendTopologyEvent(da, new TopologyEvent(Type.TOPOLOGY_CHANGING, oldView,
+                        null));
+            }
+	        logger.error("forcedShutdown: deactivating DiscoveryService.");
+	        // to make sure no further event is sent after this, flag this service as deactivated
+            activated = false;
+		}
+	}
+
 }

Modified: sling/trunk/bundles/extensions/discovery/impl/src/main/java/org/apache/sling/discovery/impl/common/heartbeat/HeartbeatHandler.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/discovery/impl/src/main/java/org/apache/sling/discovery/impl/common/heartbeat/HeartbeatHandler.java?rev=1489455&r1=1489454&r2=1489455&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/discovery/impl/src/main/java/org/apache/sling/discovery/impl/common/heartbeat/HeartbeatHandler.java
(original)
+++ sling/trunk/bundles/extensions/discovery/impl/src/main/java/org/apache/sling/discovery/impl/common/heartbeat/HeartbeatHandler.java
Tue Jun  4 14:22:52 2013
@@ -294,6 +294,8 @@ public class HeartbeatHandler implements
             				" with the same sling.id. My sling.id is "+slingId+", " +
     						" Check for sling.id.file in your installation of all instances in this cluster
" +
     						"to verify this! Duplicate sling.ids are not allowed within a cluster!");
+            		logger.error("issueClusterLocalHeartbeat: sending TOPOLOGY_CHANGING before
self-disabling.");
+            		discoveryService.forcedShutdown();
             		logger.error("issueClusterLocalHeartbeat: disabling discovery.impl");
             		activated = false;
             		if (context!=null) {



Mime
View raw message