remoteproxy.java
来自「最新的关于精通rmi这本书的源码」· Java 代码 · 共 49 行
JAVA
49 行
/*
* Copyright 1999 by dreamBean Software,
* All rights reserved.
*/
package smartworld.server;
import java.lang.reflect.Method;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.InvocationTargetException;
import java.rmi.Remote;
import java.rmi.RemoteException;
/**
* This is a smart proxy wrapper that delegates to a real remote object
*
* Note that it is not tightly bound to the remote object interface,
* and can therefore be reused with any remote object(!)
*
* @author Rickard 謆erg (rickard@dreambean.com)
* @version $Revision:$
*/
public class RemoteProxy
implements InvocationHandler
{
Object next;
// Constructors --------------------------------------------------
RemoteProxy(Object next)
{
this.next = next;
}
// Public --------------------------------------------------------
public Object invoke(Object proxy,
Method method,
Object[] args)
throws Throwable
{
try
{
return method.invoke(next, args);
} catch (InvocationTargetException e)
{
throw e.getTargetException();
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?