@Override public Object instantiate(Class<?> rulesClass) throws RulesInstantiationException { // Ensure that instantiation will be done in strategy classLoader. // ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader(); Thread.currentThread().setContextClassLoader(getClassLoader()); try { return getEngineFactory().newEngineInstance(); } catch (Exception e) { throw new RulesInstantiationException(e); } finally { Thread.currentThread().setContextClassLoader(oldClassLoader); } }
@Override public Object instantiate(Class<?> rulesClass) throws RulesInstantiationException { // Ensure that instantiation will be done in strategy classLoader. // ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader(); Thread.currentThread().setContextClassLoader(getClassLoader()); try { return getEngineFactory().newEngineInstance(); } catch (Exception e) { throw new RulesInstantiationException(e); } finally { Thread.currentThread().setContextClassLoader(oldClassLoader); } }
@Override public void reset() { super.reset(); if (engineFactory != null) { getEngineFactory().reset(false); } }
@Override public void reset() { super.reset(); if (engineFactory != null) { getEngineFactory().reset(false); } }
@Override public Class<?> getGeneratedRulesClass() throws RulesInstantiationException { // Service class for current implementation will be class, generated at // runtime by factory. // Using project class loader for interface generation. // ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader(); Thread.currentThread().setContextClassLoader(getClassLoader()); try { return getEngineFactory().getInterfaceClass(); } catch (Exception e) { throw new RulesInstantiationException("Failed to resolve a interface.", e); } finally { Thread.currentThread().setContextClassLoader(oldClassLoader); } }
@Override public Class<?> getGeneratedRulesClass() throws RulesInstantiationException { // Service class for current implementation will be class, generated at // runtime by factory. // Using project class loader for interface generation. // ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader(); Thread.currentThread().setContextClassLoader(getClassLoader()); try { return getEngineFactory().getInterfaceClass(); } catch (Exception e) { throw new RulesInstantiationException("Failed to resolve a interface.", e); } finally { Thread.currentThread().setContextClassLoader(oldClassLoader); } }