ASSIGNED - bug 17: Generalize agent management and registration beyond JMS
https://bugzilla.argeo.org/show_bug.cgi?id=17
git-svn-id: https://svn.argeo.org/commons/trunk@4483
4cfe0d0a-d680-48aa-b62c-
e0a02a3f76cc
package org.argeo.jcr;
import java.lang.reflect.InvocationHandler;
package org.argeo.jcr;
import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.util.ArrayList;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.util.ArrayList;
protected class JcrSessionInvocationHandler implements InvocationHandler {
public Object invoke(Object proxy, Method method, Object[] args)
protected class JcrSessionInvocationHandler implements InvocationHandler {
public Object invoke(Object proxy, Method method, Object[] args)
+ throws Throwable, RepositoryException {
Session threadSession = session.get();
if (threadSession == null) {
if ("logout".equals(method.getName()))// no need to login
Session threadSession = session.get();
if (threadSession == null) {
if ("logout".equals(method.getName()))// no need to login
}
preCall(threadSession);
}
preCall(threadSession);
- Object ret = method.invoke(threadSession, args);
+ Object ret;
+ try {
+ ret = method.invoke(threadSession, args);
+ } catch (InvocationTargetException e) {
+ Throwable cause = e.getCause();
+ if (cause instanceof RepositoryException)
+ throw (RepositoryException) cause;
+ else
+ throw cause;
+ }
if ("logout".equals(method.getName())) {
session.remove();
Thread thread = Thread.currentThread();
if ("logout".equals(method.getName())) {
session.remove();
Thread thread = Thread.currentThread();