private StageLibraryDelegate createInstance(StageLibraryDelegateDefinitition def) {
    StageLibraryDelegate instance  = null;
    ClassLoader classLoader = Thread.currentThread().getContextClassLoader();

    try {
      Thread.currentThread().setContextClassLoader(def.getClassLoader());
      instance = def.getKlass().newInstance();
    } catch (InstantiationException | IllegalAccessException ex) {
      LOG.error("Can't create instance of delegator: " + ex.toString(), ex);
    } finally {
      Thread.currentThread().setContextClassLoader(classLoader);
    }

    return instance;
  }
private StageLibraryDelegate createInstance ( StageLibraryDelegateDefinitition def ) { StageLibraryDelegate instance = null ; ClassLoader classLoader = Thread . currentThread ( ) . getContextClassLoader ( ) ; try { Thread . currentThread ( ) . setContextClassLoader ( def . getClassLoader ( ) ) ; instance = def . getKlass ( ) . newInstance ( ) ; } catch ( InstantiationException | IllegalAccessException ex ) { LOG . error ( "Can't create instance of delegator: " + ex . toString ( ) , ex ) ; } finally { Thread . currentThread ( ) . setContextClassLoader ( classLoader ) ; } return instance ; }
Create actual instance of delegator.

@param def Delegator definition
@return New instance or null on any issue