From d74732f5cd87b68aed10ea3fcfcb24171b9f5d67 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Tue, 1 Oct 2002 03:46:43 +0000 Subject: ObjectInputStream.java (resolveProxyClass): New method from Classpath. * java/io/ObjectInputStream.java (resolveProxyClass): New method from Classpath. * Makefile.in: Rebuilt. * Makefile.am (rmi_java_source_files): Added new files. * gnu/java/rmi/RMIMarshalledObjectInputStream.java, gnu/java/rmi/RMIMarshalledObjectOutputStream.java, gnu/java/rmi/server/ConnectionRunnerPool.java: New files from Classpath. * gnu/java/rmi/dgc/DGCImpl.java, gnu/java/rmi/dgc/DGCImpl_Skel.java, gnu/java/rmi/dgc/DGCImpl_Stub.java, gnu/java/rmi/registry/RegistryImpl_Skel.java, gnu/java/rmi/registry/RegistryImpl_Stub.java, gnu/java/rmi/server/RMIHashes.java, gnu/java/rmi/server/RMIObjectInputStream.java, gnu/java/rmi/server/RMIObjectOutputStream.java, gnu/java/rmi/server/UnicastConnection.java, gnu/java/rmi/server/UnicastConnectionManager.java, gnu/java/rmi/server/UnicastRef.java, gnu/java/rmi/server/UnicastServer.java, gnu/java/rmi/server/UnicastServerRef.java, java/rmi/MarshalledObject.java, java/rmi/server/RMIClassLoader.java, java/rmi/server/RemoteObject.java, java/rmi/server/UnicastRemoteObject.java, java/security/SecureClassLoader.java: Merged from Classpath. From-SVN: r57675 --- libjava/java/rmi/server/UnicastRemoteObject.java | 71 ++++++++++++++++++++---- 1 file changed, 59 insertions(+), 12 deletions(-) (limited to 'libjava/java/rmi/server/UnicastRemoteObject.java') diff --git a/libjava/java/rmi/server/UnicastRemoteObject.java b/libjava/java/rmi/server/UnicastRemoteObject.java index 5571b9f0b49..a9c4f35099c 100644 --- a/libjava/java/rmi/server/UnicastRemoteObject.java +++ b/libjava/java/rmi/server/UnicastRemoteObject.java @@ -42,10 +42,17 @@ import java.rmi.Remote; import java.rmi.server.RemoteRef; import java.rmi.NoSuchObjectException; import gnu.java.rmi.server.UnicastServerRef; +import gnu.java.rmi.server.UnicastServer; public class UnicastRemoteObject extends RemoteServer { +private static final long serialVersionUID = 4974527148936298033L; +//The following serialized fields are from Java API Documentation "Serialized form" +private int port = 0; +private RMIClientSocketFactory csf = null; +private RMIServerSocketFactory ssf = null; + protected UnicastRemoteObject() throws RemoteException { this(0); } @@ -55,11 +62,21 @@ protected UnicastRemoteObject(int port) throws RemoteException { } protected UnicastRemoteObject(int port, RMIClientSocketFactory csf, RMIServerSocketFactory ssf) throws RemoteException { - super(new UnicastServerRef(new ObjID(), port, ssf)); + this.port = port; + //Is RMIXXXSocketFactory serializable + //this.csf = csf; + //this.ssf = ssf; + this.ref = new UnicastServerRef(new ObjID(), port, ssf); + //Should we export it here? + // if we export, we got infinite recursive call: + // UnicastRemoteObject.->...->UnicastServer.startDGC()->UnicastRemoteObject.->... + //exportObject(this); } protected UnicastRemoteObject(RemoteRef ref) throws RemoteException { super((UnicastServerRef)ref); + //Should we export it here? + //exportObject(this); } public Object clone() throws CloneNotSupportedException { @@ -71,16 +88,46 @@ public static RemoteStub exportObject(Remote obj) throws RemoteException { return (sref.exportObject(obj)); } -public static Remote exportObject(Remote obj, int port) throws RemoteException { - return (exportObject(obj)); -} - -public static Remote exportObject(Remote obj, int port, RMIClientSocketFactory csf, RMIServerSocketFactory ssf) throws RemoteException { - return (exportObject(obj)); -} - -public static boolean unexportObject(Remote obj, boolean force) throws NoSuchObjectException { - throw new Error("Not implemented"); -} + public static Remote exportObject(Remote obj, int port) throws RemoteException + { + return exportObject(obj, port, null); + } + + protected static Remote exportObject(Remote obj, int port, RMIServerSocketFactory ssf) + throws RemoteException + { + UnicastServerRef sref = null; + if (obj instanceof RemoteObject) + sref = (UnicastServerRef)((RemoteObject)obj).getRef (); + if(sref == null) + { + sref = new UnicastServerRef(new ObjID (), port, ssf); + } + return (sref.exportObject (obj)); + } + + /** + * FIX ME + */ + public static Remote exportObject(Remote obj, int port, RMIClientSocketFactory csf, + RMIServerSocketFactory ssf) + throws RemoteException + { + return (exportObject(obj, port, ssf)); + } + + public static boolean unexportObject(Remote obj, boolean force) + throws RemoteException, NoSuchObjectException + { + if (obj instanceof RemoteObject) + { + UnicastServerRef sref = (UnicastServerRef)((RemoteObject)obj).getRef(); + return sref.unexportObject(obj, force); + } + else + //FIX ME + ; + return true; + } } -- cgit v1.2.3