src/share/classes/java/rmi/server/RemoteObjectInvocationHandler.java

Print this page




 121      * implemented by the <code>proxy</code>'s class, then that exception
 122      * is wrapped in an {@link UnexpectedException} and the wrapped
 123      * exception is thrown.  Otherwise, the exception thrown by
 124      * <code>invoke</code> is thrown by this method.
 125      * </ul>
 126      *
 127      * <p>The semantics of this method are unspecified if the
 128      * arguments could not have been produced by an instance of some
 129      * valid dynamic proxy class containing this invocation handler.
 130      *
 131      * @param proxy the proxy instance that the method was invoked on
 132      * @param method the <code>Method</code> instance corresponding to the
 133      * interface method invoked on the proxy instance
 134      * @param args an array of objects containing the values of the
 135      * arguments passed in the method invocation on the proxy instance, or
 136      * <code>null</code> if the method takes no arguments
 137      * @return the value to return from the method invocation on the proxy
 138      * instance
 139      * @throws  Throwable the exception to throw from the method invocation
 140      * on the proxy instance
 141      * @see
 142      **/
 143     public Object invoke(Object proxy, Method method, Object[] args)
 144         throws Throwable
 145     {
 146         if (method.getDeclaringClass() == Object.class) {
 147             return invokeObjectMethod(proxy, method, args);
 148         } else {
 149             return invokeRemoteMethod(proxy, method, args);
 150         }
 151     }
 152 
 153     /**
 154      * Handles java.lang.Object methods.
 155      **/
 156     private Object invokeObjectMethod(Object proxy,
 157                                       Method method,
 158                                       Object[] args)
 159     {
 160         String name = method.getName();
 161 




 121      * implemented by the <code>proxy</code>'s class, then that exception
 122      * is wrapped in an {@link UnexpectedException} and the wrapped
 123      * exception is thrown.  Otherwise, the exception thrown by
 124      * <code>invoke</code> is thrown by this method.
 125      * </ul>
 126      *
 127      * <p>The semantics of this method are unspecified if the
 128      * arguments could not have been produced by an instance of some
 129      * valid dynamic proxy class containing this invocation handler.
 130      *
 131      * @param proxy the proxy instance that the method was invoked on
 132      * @param method the <code>Method</code> instance corresponding to the
 133      * interface method invoked on the proxy instance
 134      * @param args an array of objects containing the values of the
 135      * arguments passed in the method invocation on the proxy instance, or
 136      * <code>null</code> if the method takes no arguments
 137      * @return the value to return from the method invocation on the proxy
 138      * instance
 139      * @throws  Throwable the exception to throw from the method invocation
 140      * on the proxy instance

 141      **/
 142     public Object invoke(Object proxy, Method method, Object[] args)
 143         throws Throwable
 144     {
 145         if (method.getDeclaringClass() == Object.class) {
 146             return invokeObjectMethod(proxy, method, args);
 147         } else {
 148             return invokeRemoteMethod(proxy, method, args);
 149         }
 150     }
 151 
 152     /**
 153      * Handles java.lang.Object methods.
 154      **/
 155     private Object invokeObjectMethod(Object proxy,
 156                                       Method method,
 157                                       Object[] args)
 158     {
 159         String name = method.getName();
 160