List of usage examples for org.springframework.aop.aspectj MethodInvocationProceedingJoinPoint proceed
@Override
public Object proceed() throws Throwable
From source file:org.geppetto.persistence.db.BundleClassLoaderAspect.java
public Object setClassLoader(MethodInvocationProceedingJoinPoint pjp) throws Throwable { // Save a reference to the classloader of the caller ClassLoader oldLoader = Thread.currentThread().getContextClassLoader(); // Get a reference to the classloader of the owning bundle ClassLoader serviceLoader = pjp.getTarget().getClass().getClassLoader(); // Set the class loader of the current thread to the class loader of the // owner of the bundle Thread.currentThread().setContextClassLoader(serviceLoader); Object returnValue = null;//w w w .j a v a 2 s. co m try { // Make the actual call to the method. returnValue = pjp.proceed(); } finally { // Reset the classloader of this Thread to the original // classloader of the method invoker. Thread.currentThread().setContextClassLoader(oldLoader); } return returnValue; }