Example usage for java.lang Thread getContextClassLoader

List of usage examples for java.lang Thread getContextClassLoader

Introduction

In this page you can find the example usage for java.lang Thread getContextClassLoader.

Prototype

@CallerSensitive
public ClassLoader getContextClassLoader() 

Source Link

Document

Returns the context ClassLoader for this thread.

Usage

From source file:plugins.tprovoost.Microscopy.MicroManagerForIcy.MMMainFrame.java

@Override
public IAcquisitionEngine2010 getAcquisitionEngine2010() {
    IAcquisitionEngine2010 pipeline = null;
    try {//w  ww  .  j  av a  2 s . c o m
        Thread currentThread = Thread.currentThread();
        ClassLoader currentClassLoader = currentThread.getContextClassLoader();
        currentThread.setContextClassLoader(PluginLoader.getLoader());
        Class<?> acquisitionEngine2010Class = ClassUtil.findClass("org.micromanager.AcquisitionEngine2010");
        if (acquisitionEngine2010Class != null) {
            pipeline = (IAcquisitionEngine2010) acquisitionEngine2010Class.getConstructors()[0]
                    .newInstance(this);
        }
        currentThread.setContextClassLoader(currentClassLoader);
    } catch (IllegalArgumentException e) {
        e.printStackTrace();
    } catch (SecurityException e) {
        e.printStackTrace();
    } catch (InstantiationException e) {
        e.printStackTrace();
    } catch (IllegalAccessException e) {
        e.printStackTrace();
    } catch (InvocationTargetException e) {
        e.printStackTrace();
    } catch (ClassNotFoundException e) {
        e.printStackTrace();
    } catch (NoClassDefFoundError e) {
        e.printStackTrace();
    }
    return pipeline;
}