Serializable, InvocationHandler, Remote
public class RemoteObjectInvocationHandler extends RemoteObject implements InvocationHandler
InvocationHandler interface for use with Java Remote Method Invocation (Java RMI). This invocation handler can be used in conjunction with a dynamic proxy instance as a replacement for a pregenerated stub class. Applications are not expected to use this class directly. A remote object exported to use a dynamic proxy with UnicastRemoteObject has an instance of this class as that proxy's invocation handler.
ref
| Constructor | Description | 
|---|---|
| RemoteObjectInvocationHandler | Creates a new  RemoteObjectInvocationHandlerconstructed with the specifiedRemoteRef. | 
public RemoteObjectInvocationHandler(RemoteRef ref)
RemoteObjectInvocationHandler constructed with the specified RemoteRef.ref - the remote refNullPointerException - if ref is null
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
proxy, and returns the result. RemoteObjectInvocationHandler implements this method as follows: 
If method is one of the following methods, it is processed as described below: 
Object.hashCode: Returns the hash code value for the proxy. Object.equals: Returns true if the argument (args[0]) is an instance of a dynamic proxy class and this invocation handler is equal to the invocation handler of that argument, and returns false otherwise. Object.toString: Returns a string representation of the proxy. If method overrides Object.finalize, it is ignored. 
Otherwise, a remote call is made as follows:
proxy is not an instance of the interface Remote, then an IllegalArgumentException is thrown. invoke method is invoked on this invocation handler's RemoteRef, passing proxy, method, args, and the method hash (defined in section 8.3 of the "Java Remote Method Invocation (RMI) Specification") for method, and the result is returned. RemoteRef.invoke and that exception is a checked exception that is not assignable to any exception in the throws clause of the method implemented by the proxy's class, then that exception is wrapped in an UnexpectedException and the wrapped exception is thrown. Otherwise, the exception thrown by invoke is thrown by this method. The semantics of this method are unspecified if the arguments could not have been produced by an instance of some valid dynamic proxy class containing this invocation handler.
invoke in interface InvocationHandler
proxy - the proxy instance that the method was invoked onmethod - the Method instance corresponding to the interface method invoked on the proxy instanceargs - an array of objects containing the values of the arguments passed in the method invocation on the proxy instance, or null if the method takes no argumentsThrowable - the exception to throw from the method invocation on the proxy instance
    © 1993, 2023, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
    https://docs.oracle.com/en/java/javase/21/docs/api/java.rmi/java/rmi/server/RemoteObjectInvocationHandler.html