From f903e73b80ccb078fb4bb8cfb5c4a44ea901a002 Mon Sep 17 00:00:00 2001 From: Norbert Frese Date: Sat, 20 Mar 2004 20:30:56 +0000 Subject: RMIIncomingThread.java: New file. 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. From-SVN: r79755 --- libjava/java/rmi/server/RemoteServer.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'libjava/java/rmi/server/RemoteServer.java') diff --git a/libjava/java/rmi/server/RemoteServer.java b/libjava/java/rmi/server/RemoteServer.java index b9cfc4e..85a2d95 100644 --- a/libjava/java/rmi/server/RemoteServer.java +++ b/libjava/java/rmi/server/RemoteServer.java @@ -39,6 +39,7 @@ package java.rmi.server; import java.io.OutputStream; import java.io.PrintStream; +import gnu.java.rmi.server.RMIIncomingThread; public abstract class RemoteServer extends RemoteObject { @@ -54,7 +55,14 @@ protected RemoteServer(RemoteRef ref) { } public static String getClientHost() throws ServerNotActiveException { - throw new Error("Not implemented"); + Thread currThread = Thread.currentThread(); + if (currThread instanceof RMIIncomingThread) { + RMIIncomingThread incomingThread = (RMIIncomingThread) currThread; + return incomingThread.getClientHost(); + } else { + throw new ServerNotActiveException( + "Unknown client host - current thread not instance of 'RMIIncomingThread'"); + } } public static void setLog(OutputStream out) { -- cgit v1.1