Update toaster example to emit lifecycle logs 05/5805/1
authorRobert Varga <rovarga@cisco.com>
Fri, 28 Mar 2014 18:58:38 +0000 (19:58 +0100)
committerRobert Varga <rovarga@cisco.com>
Fri, 28 Mar 2014 18:58:38 +0000 (19:58 +0100)
Change-Id: I8a73f71d315489d349aa3f2b701c5cbf2ef5a2c6
Signed-off-by: Robert Varga <rovarga@cisco.com>
opendaylight/md-sal/samples/toaster-consumer/src/main/java/org/opendaylight/controller/config/yang/config/toaster_consumer/impl/ToasterConsumerModule.java
opendaylight/md-sal/samples/toaster-provider/src/main/java/org/opendaylight/controller/config/yang/config/toaster_provider/impl/ToasterProviderModule.java

index c006a34..486cdcf 100644 (file)
@@ -17,11 +17,15 @@ import org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.toaster.rev091120
 import org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.toaster.rev091120.ToasterService;
 import org.opendaylight.yangtools.concepts.Registration;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 /**
 *
 */
 public final class ToasterConsumerModule extends org.opendaylight.controller.config.yang.config.toaster_consumer.impl.AbstractToasterConsumerModule
  {
+    private static final Logger log = LoggerFactory.getLogger(ToasterConsumerModule.class);
 
     public ToasterConsumerModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
         super(identifier, dependencyResolver);
@@ -55,6 +59,7 @@ public final class ToasterConsumerModule extends org.opendaylight.controller.con
             public void close() throws Exception {
                 runtimeRegistration.close();
                 notificationRegistration.close();
+                log.info("Toaster consumer (instance {}) torn down.", this);
             }
 
             @Override
@@ -63,6 +68,8 @@ public final class ToasterConsumerModule extends org.opendaylight.controller.con
             }
         }
 
-        return new AutoCloseableToastConsumer();
+        AutoCloseable ret = new AutoCloseableToastConsumer();
+        log.info("Toaster consumer (instance {}) initialized.", ret);
+        return ret;
     }
 }
index 1029105..8abff2c 100644 (file)
@@ -15,11 +15,15 @@ import org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.toaster.rev091120
 import org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.toaster.rev091120.ToasterData;
 import org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.toaster.rev091120.ToasterService;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 /**
 *
 */
 public final class ToasterProviderModule extends org.opendaylight.controller.config.yang.config.toaster_provider.impl.AbstractToasterProviderModule
  {
+    private static final Logger log = LoggerFactory.getLogger(ToasterProviderModule.class);
 
     public ToasterProviderModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
         super(identifier, dependencyResolver);
@@ -58,6 +62,7 @@ public final class ToasterProviderModule extends org.opendaylight.controller.con
             public void close() throws Exception {
                 rpcRegistration.close();
                 runtimeReg.close();
+                log.info("Toaster provider (instance {}) torn down.", this);
             }
 
             @Override
@@ -66,7 +71,8 @@ public final class ToasterProviderModule extends org.opendaylight.controller.con
             }
         }
 
-        return new AutoCloseableToaster();
+        AutoCloseable ret = new AutoCloseableToaster();
+        log.info("Toaster provider (instance {}) initialized.", ret);
+        return ret;
     }
-
 }