import java.rmi.activation.*; public class RemoteActivationExample { public static void main(String[] args) { ActivationGroupDesc groupDesc; ActivationGroupID groupID; ActivationDesc objectDesc; ActivationID objectID; try { // Create the activation group groupDesc = new ActivationGroupDesc(null, null); groupID = ActivationGroup.createGroup(groupDesc); // Create the activation descriptor objectDesc = new ActivationDesc("com.example.RemoteObject", "http://example.com/RemoteObject.jar", null); // Activate the remote object objectID = ActivationGroup.getSystem().registerObject(objectDesc); RemoteObjectInterface remoteObject = (RemoteObjectInterface) objectID.activate(true); // Use the remote object remoteObject.doSomething(); } catch (Exception e) { e.printStackTrace(); } } }


上一篇:
下一篇:
切换中文