import akka.actor.ActorSystem;
import akka.actor.Props;
-import akka.japi.Effect;
import akka.osgi.BundleDelegatingClassLoader;
import com.typesafe.config.Config;
import com.typesafe.config.ConfigFactory;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
import java.util.concurrent.TimeUnit;
import org.opendaylight.controller.cluster.ActorSystemProvider;
import org.opendaylight.controller.cluster.ActorSystemProviderListener;
final Bundle bundle = bundleContext.getBundle();
- final BundleDelegatingClassLoader classLoader = new BundleDelegatingClassLoader(bundle, Thread.currentThread()
- .getContextClassLoader());
+ final BundleDelegatingClassLoader classLoader = AccessController.doPrivileged(
+ (PrivilegedAction<BundleDelegatingClassLoader>) () ->
+ new BundleDelegatingClassLoader(bundle, Thread.currentThread().getContextClassLoader()));
final AkkaConfigurationReader configurationReader = new FileAkkaConfigurationReader();
final Config akkaConfig = ConfigFactory.load(configurationReader.read()).getConfig(CONFIGURATION_NAME);
actorSystem.actorOf(Props.create(TerminationMonitor.class), TerminationMonitor.ADDRESS);
- actorSystem.actorOf(QuarantinedMonitorActor.props(new Effect() {
-
- @Override
- public void apply() throws Exception {
- // restart the entire karaf container
- LOG.warn("Restarting karaf container");
- System.setProperty("karaf.restart", "true");
- bundleContext.getBundle(0).stop();
- }
+ actorSystem.actorOf(QuarantinedMonitorActor.props(() -> {
+ // restart the entire karaf container
+ LOG.warn("Restarting karaf container");
+ System.setProperty("karaf.restart.jvm", "true");
+ bundleContext.getBundle(0).stop();
}), QuarantinedMonitorActor.ADDRESS);
-
}
@Override
}
@Override
+ @SuppressWarnings("checkstyle:IllegalCatch")
public void close() {
LOG.info("Shutting down ActorSystem");