From e835c12a0e664d4b68ae8f0b19ddc7c28e3acf17 Mon Sep 17 00:00:00 2001 From: mkoch Date: Sat, 20 Mar 2004 20:30:56 +0000 Subject: 2004-03-20 Norbert Frese * gnu/java/rmi/server/RMIIncomingThread.java: New file. * gcc/libjava/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'. * gcc/libjava/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. * gcc/libjava/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. * gcc/libjava/gnu/java/rmi/server/UnicastRemoteCall.java: Start a new RMIObjectInputStream/RMIObjectOutputStream for every rmi-message. * gcc/libjava/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. * gcc/libjava/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. * gcc/libjava/java/rmi/server/RemoteServer.java (getClientHost): Implementated. * gcc/libjava/Makefile.am (rmi_java_source_files): Added gnu/java/rmi/server/RMIIncomingThread.java. * Makefile.in: Regenerated. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@79755 138bc75d-0d04-0410-961f-82ee72b054a4 --- libjava/gnu/java/rmi/server/UnicastServer.java | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'libjava/gnu/java/rmi/server/UnicastServer.java') diff --git a/libjava/gnu/java/rmi/server/UnicastServer.java b/libjava/gnu/java/rmi/server/UnicastServer.java index fb6ec1f35a5..ace43f01861 100644 --- a/libjava/gnu/java/rmi/server/UnicastServer.java +++ b/libjava/gnu/java/rmi/server/UnicastServer.java @@ -99,13 +99,19 @@ public static void dispatch(UnicastConnection conn) throws Exception { case MESSAGE_CALL: incomingMessageCall(conn); break; + case MESSAGE_PING: + // jdk sends a ping before each method call -> answer it! + DataOutputStream out = conn.getDataOutputStream(); + out.writeByte(MESSAGE_PING_ACK); + out.flush(); + break; default: throw new Exception("bad method type"); } } private static void incomingMessageCall(UnicastConnection conn) throws IOException { - ObjectInputStream in = conn.getObjectInputStream(); + ObjectInputStream in = conn.startObjectInputStream(); // (re)start ObjectInputStream ObjID objid = ObjID.read(in); int method = in.readInt(); @@ -138,13 +144,18 @@ private static void incomingMessageCall(UnicastConnection conn) throws IOExcepti conn.getDataOutputStream().writeByte(MESSAGE_CALL_ACK); - ObjectOutputStream out = conn.getObjectOutputStream(); + ObjectOutputStream out = conn.startObjectOutputStream(); // (re)start ObjectOutputStream out.writeByte(returncode); (new UID()).write(out); + + //System.out.println("returnval=" + returnval + " returncls=" + returncls); + if(returnval != null && returncls != null) ((RMIObjectOutputStream)out).writeValue(returnval, returncls); - else if (!(returnval instanceof RMIVoidValue)) + + // 1.1/1.2 void return type detection: + else if (!(returnval instanceof RMIVoidValue || returncls == Void.TYPE)) out.writeObject(returnval); out.flush(); -- cgit v1.2.3