2 * Copyright (c) 2016 Ericsson India Global Services Pvt Ltd. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.netvirt.fcapsmanager.countermanager;
10 import org.osgi.framework.BundleActivator;
11 import org.osgi.framework.BundleContext;
12 import org.slf4j.LoggerFactory;
14 import javax.management.InstanceNotFoundException;
15 import javax.management.MBeanException;
16 import javax.management.MalformedObjectNameException;
17 import javax.management.ReflectionException;
18 import java.io.IOException;
20 public class Activator implements BundleActivator {
21 private final static org.slf4j.Logger LOG = LoggerFactory.getLogger(Activator.class);
22 private Runnable listener;
23 private Thread listenerThread;
25 public void start(BundleContext context) throws InstanceNotFoundException, MalformedObjectNameException, MBeanException, ReflectionException, IOException {
26 LOG.info("Starting countermanager bundle ");
27 PMRegistrationListener notificationListeners = new PMRegistrationListener(context);
29 listener = notificationListeners;
30 listenerThread = new Thread(listener);
31 listenerThread.start();
32 } catch (Exception e) {
33 LOG.error("Exception in counter thread {}", e);
37 public void stop(BundleContext context) {
38 LOG.info("Stopping countermanager bundle ");