Enhancements to actor naming, logging and monitoring
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / datastore / ActorSystemFactory.java
index c562e6f50f173f27b943ab358c7828c039eecaf1..baf04fe43b771fddc1c009d11aed056dea6bbe24 100644 (file)
@@ -9,12 +9,23 @@
 package org.opendaylight.controller.cluster.datastore;
 
 import akka.actor.ActorSystem;
+import akka.actor.Props;
+import com.google.common.base.Function;
 import com.typesafe.config.ConfigFactory;
 
+import javax.annotation.Nullable;
+
 public class ActorSystemFactory {
-    private static final ActorSystem actorSystem =
-        ActorSystem.create("opendaylight-cluster", ConfigFactory
-            .load().getConfig("ODLCluster"));
+    private static final ActorSystem actorSystem = (new Function<Void, ActorSystem>(){
+
+        @Nullable @Override public ActorSystem apply(@Nullable Void aVoid) {
+                ActorSystem system =
+                    ActorSystem.create("opendaylight-cluster", ConfigFactory
+                        .load().getConfig("ODLCluster"));
+                system.actorOf(Props.create(TerminationMonitor.class), "termination-monitor");
+                return system;
+        }
+    }).apply(null);
 
     public static final ActorSystem getInstance(){
         return actorSystem;