From 1ea4bde3447a9c4e437be979b5dc8860d89031cd Mon Sep 17 00:00:00 2001 From: Michael Koch Date: Sun, 21 Mar 2004 10:10:14 +0000 Subject: 2004-03-21 Norbert Frese * gnu/java/rmi/server/RMIIncomingThread.java: New file. * gnu/java/rmi/server/UnicastConnection.java: Create a new RMIObjectOuputStream/RMIObjectInputStream for every rmi-message. (getObjectInputStream): Return object reference, throw IOException if null. (startObjectInputStream): Create new RMIObjectInputStream on top of 'din'. (getObjectOutputStream): Return object reference, throw IOException if null. (startObjectOutputStream): Create new RMIObjectOutputStream on top of 'dout'. * gnu/java/rmi/server/UnicastConnectionManager.java: (UnicastConnectionManager): Throw RemoteException if port is not available. (getInstance): Throw RemoteException. (run): Lookup client host and attach it to new RMIIncomingThread for later retrieval. * gnu/java/rmi/server/UnicastRef.java: Start a new RMIObjectInputStream/RMIObjectOutputStream for every rmi-message. Collect Exceptions which are returned by a rmi-call and fix void returns. * gnu/java/rmi/server/UnicastRemoteCall.java: Start a new RMIObjectInputStream/RMIObjectOutputStream for every rmi-message. * gnu/java/rmi/server/UnicastServer.java: (dispatch): Answer ping messages which are sent by other java implementions. (incomingMessageCall): Start a new RMIObjectInputStream/RMIObjectOutputStream for every rmi-message and fix void return problems. * gnu/java/rmi/server/UnicastServerRef.java (UnicastServerRef): Throw RemoteException. (exportObject): Find the class up the class hierarchy which has a _Stub generated by rmic. In some situations it is necessary to export a subclass of the class which has the _Stub. For instance when the class with has the _Stub is abstract. (findStubSkelClass): New method which looks for the class which has the _Stub. (getClientHost): Implementated. * java/rmi/server/RemoteServer.java (getClientHost): Implemented. * gnu/java/rmi/server/Makefile.am (EXTRA_DIST): RMIIncomingThread.java. --- gnu/java/rmi/server/UnicastRemoteCall.java | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'gnu/java/rmi/server/UnicastRemoteCall.java') diff --git a/gnu/java/rmi/server/UnicastRemoteCall.java b/gnu/java/rmi/server/UnicastRemoteCall.java index 2d7d6d4a9..76dd8e215 100644 --- a/gnu/java/rmi/server/UnicastRemoteCall.java +++ b/gnu/java/rmi/server/UnicastRemoteCall.java @@ -138,6 +138,21 @@ public class UnicastRemoteCall oout.flush(); } + /** + * + * (re)starts ObjectInputStream + * + */ + public ObjectInput startInputStream() throws IOException + { + if (conn != null) { + return (oin = conn.startObjectInputStream()); + } else { + return getInputStream(); // dummy Input Stream + } + + } + public ObjectInput getInputStream() throws IOException { if (conn != null) @@ -177,7 +192,7 @@ public class UnicastRemoteCall DataOutputStream dout = conn.getDataOutputStream(); dout.write(MESSAGE_CALL); - oout = conn.getObjectOutputStream(); + oout = conn.startObjectOutputStream(); // (re)start ObjectOutputStream objid.write(oout); oout.writeInt(opnum); oout.writeLong(hash); @@ -194,7 +209,7 @@ public class UnicastRemoteCall if (din.readByte() != MESSAGE_CALL_ACK) throw new RemoteException("Call not acked"); - oin = getInputStream(); + oin = startInputStream(); returncode = oin.readByte(); UID.read(oin); } -- cgit v1.2.1