# HG changeset patch # User Miloslav Zezulka # Date 1505736256 -7200 # Node ID e67aeba2003a974d916f23e01c9e08eb38e891b9 # Parent 3f1f63227847bdea28e979c1e740aba4ee738b38 Map activate method for VmNativeLibrariesBackend Reviewed-by: jerboaa Review-thread: http://icedtea.classpath.org/pipermail/thermostat/2017-September/024875.html diff -r 3f1f63227847 -r e67aeba2003a plugins/jvm-overview/agent/src/main/java/com/redhat/thermostat/jvm/overview/agent/internal/model/VmNativeLibrariesBackend.java --- 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;