java.rmi.server

Class RemoteObjectInvocationHandler

public class RemoteObjectInvocationHandler extends RemoteObject implements InvocationHandler, Remote, Serializable

Together with dynamic proxy instance, this class replaces the generated RMI stub (*_Stub) classes that (following 1.5 specification) should be no longer required. It is unusual to use the instances of this class directly in the user program. Such instances are automatically created and returned by {@link Registry} or {@link UnicastRemoteObject} methods if the remote reference is known but the corresponding stub class is not accessible.

See Also: Registry

Constructor Summary
RemoteObjectInvocationHandler(RemoteRef reference)
Construct the remote invocation handler that forwards calls to the given remote object.
Method Summary
Objectinvoke(Object proxyInstance, Method method, Object[] parameters)
Invoke the remote method.

Constructor Detail

RemoteObjectInvocationHandler

public RemoteObjectInvocationHandler(RemoteRef reference)
Construct the remote invocation handler that forwards calls to the given remote object.

Parameters: reference the reference to the remote object where the method calls should be forwarded.

Method Detail

invoke

public Object invoke(Object proxyInstance, Method method, Object[] parameters)
Invoke the remote method. When the known method is invoked on a created RMI stub proxy class, the call is delivered to this method and then transferred to the {@link RemoteRef#invoke(Remote, Method, Object[], long)} of the remote reference that was passed in constructor. The methods are handled as following:

Parameters: proxyInstance the instance of the proxy stub method the method being invoked parameters the method parameters

Returns: the method return value, returned by RemoteRef.invoke

Throws: IllegalAccessException if the passed proxy instance does not implement Remote interface. UnexpectedException if remote call throws some exception, not listed in the throws clause of the method being called. Throwable that is thrown by remote call, if that exception is listend in the throws clause of the method being called.