/** * Handles remote methods. **/ @Override protected Object invokeRemoteMethod( final Object proxy, final Method method, final Object... args) throws Throwable { // Use the same classloader that during the creation of this object ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader(); Thread.currentThread().setContextClassLoader(classLoader); setClassLoader(oldClassLoader); try { // Generate a requestId RequestId requestId = new RequestId(sessionId, requestNb); // Set this request in the current context HACurrent.getHACurrent().putNextReq(requestId); Object result = super.invokeRemoteMethod(proxy, method, args); // Update the request number now that all is OK requestNb++; if (onFailover) { onFailover = false; HACurrent.getHACurrent().setOnFailover(false); } return result; } finally { Thread.currentThread().setContextClassLoader(oldClassLoader); } }
@Override protected void onExceptionHook( final String objectName, final CMIReferenceable<Object> cmiReferenceable) throws Throwable { setCurrentRef(null); // Set onFailover onFailover = true; // Propagate onFailover status to the server HACurrent.getHACurrent().setOnFailover(true); }
invocationHandler = new StatefulPOJOInvocationHandler( classLoader, clusterViewManager, objectName, protocolName, itfClass, clusterViewManager.getSessionId());