?? dynamicremoteobject.java
字號(hào):
/*
* Copyright 1999 by dreamBean Software,
* All rights reserved.
*/
package smartworld.server;
import java.lang.reflect.Proxy;
import java.net.URL;
import java.rmi.Remote;
import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;
/**
* This is a replacement for UnicastRemoteObject that you can use to export objects with
* dynamically generated stubs.
*
* @author Rickard 謆erg (rickard@dreambean.com)
*/
public class DynamicRemoteObject
{
// Static --------------------------------------------------------
static DynamicClassLoader dcl;
static
{
try
{
dcl = new DynamicClassLoader(new URL[]
{
new URL(System.getProperty("java.rmi.server.codebase"))
});
} catch (Exception e)
{
e.printStackTrace();
}
}
public synchronized static Remote exportObject(Remote obj)
throws RemoteException
{
Class remote = obj.getClass().getInterfaces()[0];
Remote proxy = (Remote) Proxy.newProxyInstance(dcl,
new Class[] { remote },
new RemoteProxy(obj));
UnicastRemoteObject.exportObject(proxy);
return proxy;
}
// Constructors --------------------------------------------------
private DynamicRemoteObject()
{
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -