@Override public R invoke(Object proxy, Method invokedMethod, Object[] args) throws Exception { try { return delegate.invoke(proxy, invokedMethod, args); } catch (ExecutionException e) { Throwable cause = e.getCause(); if (cause instanceof RuntimeException) { throw (RuntimeException) cause; } for (Class<?> exception : declaredExceptions) { if (exception.isInstance(cause)) { throw cause instanceof Exception ? (Exception) cause : e; } } throw new CommandExecutionException( "Command execution resulted in a checked exception that was " + "not declared on the gateway", cause); } } }
@Override public R invoke(Object proxy, Method invokedMethod, Object[] args) throws Exception { try { return delegate.invoke(proxy, invokedMethod, args); } catch (ExecutionException e) { Throwable cause = e.getCause(); if (cause instanceof RuntimeException) { throw (RuntimeException) cause; } for (Class<?> exception : declaredExceptions) { if (exception.isInstance(cause)) { throw cause instanceof Exception ? (Exception) cause : e; } } throw new CommandExecutionException( "Command execution resulted in a checked exception that was " + "not declared on the gateway", cause); } } }
@Override public R invoke(Object proxy, Method invokedMethod, Object[] args) throws Exception { try { return delegate.invoke(proxy, invokedMethod, args); } catch (ExecutionException e) { Throwable cause = e.getCause(); if (cause instanceof RuntimeException) { throw (RuntimeException) cause; } for (Class<?> exception : declaredExceptions) { if (exception.isInstance(cause)) { throw cause instanceof Exception ? (Exception) cause : e; } } throw new CommandExecutionException( "Command execution resulted in a checked exception that was " + "not declared on the gateway", cause); } } }
@Override public R invoke(Object proxy, Method invokedMethod, Object[] args) throws Exception { try { return delegate.invoke(proxy, invokedMethod, args); } catch (InterruptedException timeout) { Thread.currentThread().interrupt(); return null; } } }
@Override public R invoke(Object proxy, Method invokedMethod, Object[] args) throws Exception { try { return delegate.invoke(proxy, invokedMethod, args); } catch (InterruptedException timeout) { Thread.currentThread().interrupt(); return null; } } }
@Override public Object invoke(Object proxy, Method method, Object[] args) throws Exception { if (Object.class.equals(method.getDeclaringClass())) { return method.invoke(this, args); } else { final InvocationHandler invocationHandler = dispatchers.get(method); return invocationHandler.invoke(proxy, method, args); } } }
@Override public R invoke(Object proxy, Method invokedMethod, Object[] args) throws Exception { return delegate.invoke(proxy, invokedMethod, args) .get(toLong(args[timeoutIndex]), (TimeUnit) args[timeUnitIndex]); }
@Override public R invoke(Object proxy, Method invokedMethod, Object[] args) throws Exception { return delegate.invoke(proxy, invokedMethod, args).get(timeout, timeUnit); } }
@Override public R invoke(Object proxy, Method invokedMethod, Object[] args) throws Exception { delegate.invoke(proxy, invokedMethod, args); return null; } }
@Override public R invoke(Object proxy, Method invokedMethod, Object[] args) throws Exception { return delegate.invoke(proxy, invokedMethod, args) .get(toLong(args[timeoutIndex]), (TimeUnit) args[timeUnitIndex]); }
@Override public R invoke(Object proxy, Method invokedMethod, Object[] args) throws Exception { delegate.invoke(proxy, invokedMethod, args); return null; } }
@Override public R invoke(Object proxy, Method invokedMethod, Object[] args) throws Exception { return delegate.invoke(proxy, invokedMethod, args).get(); } }
@Override public R invoke(Object proxy, Method invokedMethod, Object[] args) throws Exception { try { return delegate.invoke(proxy, invokedMethod, args); } catch (TimeoutException timeout) { return null; } } }
@Override public R invoke(Object proxy, Method invokedMethod, Object[] args) throws Exception { return delegate.invoke(proxy, invokedMethod, args).get(); } }
@Override public R invoke(Object proxy, Method invokedMethod, Object[] args) throws Exception { try { return delegate.invoke(proxy, invokedMethod, args); } catch (TimeoutException timeout) { return null; } } }
@Override public Object invoke(Object proxy, Method method, Object[] args) throws Exception { if (Object.class.equals(method.getDeclaringClass())) { return method.invoke(this, args); } else { final InvocationHandler invocationHandler = dispatchers.get(method); return invocationHandler.invoke(proxy, method, args); } }
@Override public R invoke(Object proxy, Method invokedMethod, Object[] args) throws Exception { return delegate.invoke(proxy, invokedMethod, args).get(timeout, timeUnit); } }
@Override public R invoke(Object proxy, Method invokedMethod, Object[] args) throws Exception { try { return delegate.invoke(proxy, invokedMethod, args); } catch (InterruptedException timeout) { Thread.currentThread().interrupt(); return null; } } }
@Override public Object invoke(Object proxy, Method method, Object[] args) throws Exception { if (Object.class.equals(method.getDeclaringClass())) { return method.invoke(this, args); } else { final InvocationHandler invocationHandler = dispatchers.get(method); return invocationHandler.invoke(proxy, method, args); } }
@SuppressWarnings("unchecked") @Override public R invoke(Object proxy, Method invokedMethod, Object[] args) throws Exception { Future<R> future = dispatcher.invoke(proxy, invokedMethod, args); if (stubGateway != null) { return (R) invokedMethod.invoke(stubGateway, args); } if (future.isDone()) { return future.get(); } return null; } }