RMIIncomingThread.java: New file.
2004-03-20 Norbert Frese <postfach@nfrese.net> * 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
This commit is contained in:
parent
079f946dad
commit
f903e73b80
11 changed files with 247 additions and 34 deletions
|
@ -116,7 +116,7 @@ private Object invokeCommon(Remote obj, Method method, Object[] params, int opnu
|
|||
dout = conn.getDataOutputStream();
|
||||
dout.writeByte(MESSAGE_CALL);
|
||||
|
||||
out = conn.getObjectOutputStream();
|
||||
out = conn.startObjectOutputStream(); // (re)start ObjectOutputStream
|
||||
|
||||
objid.write(out);
|
||||
out.writeInt(opnum);
|
||||
|
@ -146,19 +146,22 @@ private Object invokeCommon(Remote obj, Method method, Object[] params, int opnu
|
|||
throw new RemoteException("Call not acked:" + returncode);
|
||||
}
|
||||
|
||||
in = conn.getObjectInputStream();
|
||||
in = conn.startObjectInputStream(); // (re)start ObjectInputStream
|
||||
returncode = in.readUnsignedByte();
|
||||
ack = UID.read(in);
|
||||
|
||||
Class cls = method.getReturnType();
|
||||
if(cls == Void.TYPE){
|
||||
returnval = null;
|
||||
in.readObject();
|
||||
}else
|
||||
returnval = ((RMIObjectInputStream)in).readValue(cls);
|
||||
|
||||
if (returncode == RETURN_NACK) {
|
||||
returnval = in.readObject(); // get Exception
|
||||
|
||||
} else if(cls == Void.TYPE) {
|
||||
returnval = null;
|
||||
// in.readObject() // not required! returntype 'void' means no field is returned.
|
||||
} else {
|
||||
returnval = ((RMIObjectInputStream)in).readValue(cls); // get returnvalue
|
||||
}
|
||||
catch (IOException e3) {
|
||||
} catch (IOException e3) {
|
||||
//for debug: e3.printStackTrace();
|
||||
throw new RemoteException("call return failed: ", e3);
|
||||
}
|
||||
|
@ -174,7 +177,8 @@ private Object invokeCommon(Remote obj, Method method, Object[] params, int opnu
|
|||
manager.discardConnection(conn);
|
||||
|
||||
if (returncode != RETURN_ACK && returnval != null) {
|
||||
throw (Exception)returnval;
|
||||
if (returncode == RETURN_NACK) throw (Exception)returnval;
|
||||
else throw new RemoteException("unexpected returncode: " + returncode);
|
||||
}
|
||||
|
||||
return (returnval);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue