changeset 2759:e67aeba2003a

Map activate method for VmNativeLibrariesBackend Reviewed-by: jerboaa Review-thread: http://icedtea.classpath.org/pipermail/thermostat/2017-September/024875.html
author Miloslav Zezulka <mzezulka@redhat.com>
date Mon, 18 Sep 2017 14:04:16 +0200
parents 3f1f63227847
children 22f2b3ea3609
files plugins/jvm-overview/agent/src/main/java/com/redhat/thermostat/jvm/overview/agent/internal/model/VmNativeLibrariesBackend.java
diffstat 1 files changed, 19 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/jvm-overview/agent/src/main/java/com/redhat/thermostat/jvm/overview/agent/internal/model/VmNativeLibrariesBackend.java	Wed Sep 06 14:05:05 2017 +0200
+++ b/plugins/jvm-overview/agent/src/main/java/com/redhat/thermostat/jvm/overview/agent/internal/model/VmNativeLibrariesBackend.java	Mon Sep 18 14:04:16 2017 +0200
@@ -37,12 +37,17 @@
 package com.redhat.thermostat.jvm.overview.agent.internal.model;
 
 import com.redhat.thermostat.backend.Backend;
+import com.redhat.thermostat.common.Version;
 import com.redhat.thermostat.jvm.overview.agent.VmListenerBackend;
+import com.redhat.thermostat.jvm.overview.agent.VmStatusListenerRegistrar;
 import com.redhat.thermostat.jvm.overview.agent.VmUpdateListener;
 import com.redhat.thermostat.storage.core.WriterID;
+import org.apache.felix.scr.annotations.Activate;
 import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Deactivate;
 import org.apache.felix.scr.annotations.Reference;
 import org.apache.felix.scr.annotations.Service;
+import org.osgi.framework.BundleContext;
 
 @Component
 @Service(value = Backend.class)
@@ -69,6 +74,20 @@
         return listenerCreator.create(vmInfoDao, vmId, pid);
     }
 
+    @Activate
+    public void componentActivated(BundleContext context) {
+        VmStatusListenerRegistrar registrar = new VmStatusListenerRegistrar(context);
+        Version version = new Version(context.getBundle());
+        initialize(writerId, registrar, version.getVersionNumber());
+    }
+
+    @Deactivate
+    protected void componentDeactivated() {
+        if (isActive()) {
+            deactivate();
+        }
+    }
+
     // DS bind method
     protected void bindVmGcStats(VmInfoDAO dao) {
         this.vmInfoDao = dao;