2 * Copyright (c) 2017 Pantheon Technologies s.r.o. 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.controller.cluster.akka.osgi.impl;
10 import akka.osgi.BundleDelegatingClassLoader;
11 import java.security.AccessController;
12 import java.security.PrivilegedAction;
13 import org.osgi.framework.BundleContext;
15 public final class BundleClassLoaderFactory {
17 private BundleClassLoaderFactory() {
21 public static ClassLoader createClassLoader(final BundleContext bundleContext) {
22 return AccessController
23 .doPrivileged((PrivilegedAction<BundleDelegatingClassLoader>) () -> new BundleDelegatingClassLoader(
24 bundleContext.getBundle(), Thread.currentThread().getContextClassLoader()));