/** * Handles remote methods. * @throws POJOInvocationHandlerException if a server cannot be chosen * @throws Throwable if the invoked method throws an exception **/ @Override protected Object invokeRemoteMethod(final Object proxy, final Method method, final Object... args) throws POJOInvocationHandlerException, Throwable { // Use the same classloader that during the creation of this object ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader(); Thread.currentThread().setContextClassLoader(classLoader); setClassLoader(oldClassLoader); try { return super.invokeRemoteMethod(proxy, method, args); } finally { Thread.currentThread().setContextClassLoader(oldClassLoader); } }
new POJOInvocationHandler( classLoader, this, providerName, protocol, ClientClusterViewProvider.class); clientClusterViewProvider =
new POJOInvocationHandler(classLoader, clusterViewManager, objectName, protocolName, itfClass);