diff options
| author | Tom Tromey <tromey@redhat.com> | 2002-10-01 03:46:43 +0000 |
|---|---|---|
| committer | Tom Tromey <tromey@gcc.gnu.org> | 2002-10-01 03:46:43 +0000 |
| commit | d74732f5cd87b68aed10ea3fcfcb24171b9f5d67 (patch) | |
| tree | bf757dbbf21b52fd568fba72014b0347b815ecdb /libjava/java/rmi/server/UnicastRemoteObject.java | |
| parent | e3e3815b7f9fdb2868f93840d6872336d871c29b (diff) | |
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
Diffstat (limited to 'libjava/java/rmi/server/UnicastRemoteObject.java')
| -rw-r--r-- | libjava/java/rmi/server/UnicastRemoteObject.java | 71 |
1 files changed, 59 insertions, 12 deletions
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.<init>->...->UnicastServer.startDGC()->UnicastRemoteObject.<init>->... + //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; + } } |
