Remove CSS modules
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / akka / osgi / impl / BundleClassLoaderFactory.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.cluster.akka.osgi.impl;
9
10 import akka.osgi.BundleDelegatingClassLoader;
11 import java.security.AccessController;
12 import java.security.PrivilegedAction;
13 import org.osgi.framework.BundleContext;
14
15 public final class BundleClassLoaderFactory {
16
17     private BundleClassLoaderFactory() {
18
19     }
20
21     public static ClassLoader createClassLoader(final BundleContext bundleContext) {
22         return AccessController
23                 .doPrivileged((PrivilegedAction<BundleDelegatingClassLoader>) () -> new BundleDelegatingClassLoader(
24                         bundleContext.getBundle(), Thread.currentThread().getContextClassLoader()));
25     }
26 }