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.vpnservice.fcapsmanager.countermanager;
10 import org.osgi.framework.BundleActivator;
11 import org.osgi.framework.BundleContext;
12 import org.slf4j.Logger;
13 import org.slf4j.LoggerFactory;
15 import javax.management.InstanceNotFoundException;
16 import javax.management.MBeanException;
17 import javax.management.MalformedObjectNameException;
18 import javax.management.ReflectionException;
19 import java.io.IOException;
21 public class Activator implements BundleActivator {
22 private final static org.slf4j.Logger LOG = LoggerFactory.getLogger(Activator.class);
23 private Runnable listener;
24 private Thread listenerThread;
26 public void start(BundleContext context) throws InstanceNotFoundException, MalformedObjectNameException, MBeanException, ReflectionException, IOException {
27 LOG.info("Starting countermanager bundle ");
28 PMRegistrationListener notificationListeners = new PMRegistrationListener(context);
30 listener = notificationListeners;
31 listenerThread = new Thread(listener);
32 listenerThread.start();
33 } catch (Exception e) {
34 LOG.error("Exception in counter thread {}", e);
38 public void stop(BundleContext context) {
39 LOG.info("Stopping countermanager bundle ");