JGroups AUTH handler in Clustering Services
[controller.git] / opendaylight / clustering / services_implementation / src / main / java / org / opendaylight / controller / clustering / services_implementation / internal / ClusterManager.java
index 122063abba0e3c92ad38c2af28a6a9e72f1dcf86..518bf7b1a84f9742e589dd37d21432e6ee42dcb0 100644 (file)
@@ -236,6 +236,17 @@ public class ClusterManager implements IClusterServices {
         return res;
     }
 
+    private void exitOnSecurityException(Exception ioe) {
+        Throwable cause = ioe.getCause();
+        while (cause != null) {
+            if (cause instanceof java.lang.SecurityException) {
+                logger.error("Failed Cluster authentication. Stopping Controller...");
+                System.exit(0);
+            }
+            cause = cause.getCause();
+        }
+    }
+
     public void start() {
         this.gossiper = startGossiper();
         if (this.gossiper != null) {
@@ -272,6 +283,7 @@ public class ClusterManager implements IClusterServices {
             logger.error("Stack Trace that raised th exception");
             logger.error("",ioe);
             this.cm = null;
+            exitOnSecurityException(ioe);
             this.stop();
         }
         logger.debug("Cache Manager has value {}", this.cm);