Bug 8967 - Various classes in cntrl/md-sal use hardcoded
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / config / yang / config / actor_system_provider / impl / factory / osgi / QuarantinedMonitorActorPropsFactory.java
1 /*
2  * Copyright (c) 2017 Pantheon Technologies s.r.o. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.controller.config.yang.config.actor_system_provider.impl.factory.osgi;
9
10 import akka.actor.Props;
11 import org.opendaylight.controller.cluster.common.actor.QuarantinedMonitorActor;
12 import org.osgi.framework.BundleContext;
13 import org.slf4j.Logger;
14 import org.slf4j.LoggerFactory;
15
16 public class QuarantinedMonitorActorPropsFactory {
17     private static final Logger LOG = LoggerFactory.getLogger(QuarantinedMonitorActorPropsFactory.class);
18
19     public static Props createProps(final BundleContext bundleContext) {
20         return QuarantinedMonitorActor.props(() -> {
21             // restart the entire karaf container
22             LOG.warn("Restarting karaf container");
23             System.setProperty("karaf.restart.jvm", "true");
24             bundleContext.getBundle().stop();
25         });
26     }
27 }