- java.lang.Object
-
- java.rmi.server.RemoteObject
-
- java.rmi.server.RemoteObjectInvocationHandler
-
- All Implemented Interfaces:
- Serializable, InvocationHandler, Remote
public class RemoteObjectInvocationHandler extends RemoteObject implements InvocationHandler
An implementation of theInvocationHandlerinterface 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
UnicastRemoteObjectorActivatablehas an instance of this class as that proxy's invocation handler.- Since:
- 1.5
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class java.rmi.server.RemoteObject
ref
-
-
Constructor Summary
Constructors Constructor and Description RemoteObjectInvocationHandler(RemoteRef ref)Creates a newRemoteObjectInvocationHandlerconstructed with the specifiedRemoteRef.
-
Method Summary
Methods Modifier and Type Method and Description Objectinvoke(Object proxy, Method method, Object[] args)Processes a method invocation made on the encapsulating proxy instance,proxy, and returns the result.
-
-
-
Constructor Detail
-
RemoteObjectInvocationHandler
public RemoteObjectInvocationHandler(RemoteRef ref)
Creates a newRemoteObjectInvocationHandlerconstructed with the specifiedRemoteRef.- Parameters:
ref- the remote ref- Throws:
NullPointerException- ifrefisnull
-
-
Method Detail
-
invoke
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
Processes a method invocation made on the encapsulating proxy instance,proxy, and returns the result.RemoteObjectInvocationHandlerimplements this method as follows:If
methodis one of the following methods, it is processed as described below:Object.hashCode: Returns the hash code value for the proxy.Object.equals: Returnstrueif 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 returnsfalseotherwise.Object.toString: Returns a string representation of the proxy.
Otherwise, a remote call is made as follows:
- If
proxyis not an instance of the interfaceRemote, then anIllegalArgumentExceptionis thrown. - Otherwise, the
invokemethod is invoked on this invocation handler'sRemoteRef, passingproxy,method,args, and the method hash (defined in section 8.3 of the "Java Remote Method Invocation (RMI) Specification") formethod, and the result is returned. - If an exception is thrown by
RemoteRef.invokeand that exception is a checked exception that is not assignable to any exception in thethrowsclause of the method implemented by theproxy's class, then that exception is wrapped in anUnexpectedExceptionand the wrapped exception is thrown. Otherwise, the exception thrown byinvokeis 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.
- Specified by:
invokein interfaceInvocationHandler- Parameters:
proxy- the proxy instance that the method was invoked onmethod- theMethodinstance 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, ornullif the method takes no arguments- Returns:
- the value to return from the method invocation on the proxy instance
- Throws:
Throwable- the exception to throw from the method invocation on the proxy instance- See Also:
UndeclaredThrowableException
-
-
Deutsche Übersetzung
Sie haben gebeten, diese Seite auf Deutsch zu besuchen. Momentan ist nur die Oberfläche übersetzt, aber noch nicht der gesamte Inhalt.Wenn Sie mir bei Übersetzungen helfen wollen, ist Ihr Beitrag willkommen. Alles, was Sie tun müssen, ist, sich auf der Website zu registrieren und mir eine Nachricht zu schicken, in der Sie gebeten werden, Sie der Gruppe der Übersetzer hinzuzufügen, die Ihnen die Möglichkeit gibt, die gewünschten Seiten zu übersetzen. Ein Link am Ende jeder übersetzten Seite zeigt an, dass Sie der Übersetzer sind und einen Link zu Ihrem Profil haben.
Vielen Dank im Voraus.
Dokument erstellt 11/06/2005, zuletzt geändert 04/03/2020
Quelle des gedruckten Dokuments:https://www.gaudry.be/de/java-api-rf-java/rmi/server/remoteobjectinvocationhandler.html
Die Infobro ist eine persönliche Seite, deren Inhalt in meiner alleinigen Verantwortung liegt. Der Text ist unter der CreativeCommons-Lizenz (BY-NC-SA) verfügbar. Weitere Informationen auf die Nutzungsbedingungen und dem Autor.
Referenzen
Diese Verweise und Links verweisen auf Dokumente, die während des Schreibens dieser Seite konsultiert wurden, oder die zusätzliche Informationen liefern können, aber die Autoren dieser Quellen können nicht für den Inhalt dieser Seite verantwortlich gemacht werden.
Der Autor dieser Website ist allein dafür verantwortlich, wie die verschiedenen Konzepte und Freiheiten, die mit den Nachschlagewerken gemacht werden, hier dargestellt werden. Denken Sie daran, dass Sie mehrere Quellinformationen austauschen müssen, um das Risiko von Fehlern zu reduzieren.