UnicastRef.java: make constructor public and check if serverobject is compatible in case client...
2003-08-11 Ingo Proetel <proetel@aicas.com> * gnu/java/rmi/server/UnicastRef.java: make constructor public and check if serverobject is compatible in case client and server are running in the same VM (remerged from Classpath on 2003-09-20) From-SVN: r71611
This commit is contained in:
parent
94322bebd2
commit
21cf98f6e0
2 changed files with 28 additions and 26 deletions
|
@ -1,3 +1,9 @@
|
|||
2003-08-11 Ingo Proetel <proetel@aicas.com>
|
||||
|
||||
* gnu/java/rmi/server/UnicastRef.java: make constructor public and check if serverobject
|
||||
is compatible in case client and server are running in the same VM
|
||||
(remerged from Classpath on 2003-09-20)
|
||||
|
||||
2003-09-19 David Daney <ddaney@avtrex.com>
|
||||
|
||||
* java/lang/ref/Reference.java (clear): Set referent to null and
|
||||
|
|
|
@ -37,32 +37,24 @@ exception statement from your version. */
|
|||
|
||||
package gnu.java.rmi.server;
|
||||
|
||||
import java.rmi.Remote;
|
||||
import java.rmi.RemoteException;
|
||||
import java.rmi.server.RemoteRef;
|
||||
import java.rmi.server.RMISocketFactory;
|
||||
import java.rmi.server.RMIClientSocketFactory;
|
||||
import java.rmi.server.RMIServerSocketFactory;
|
||||
import java.rmi.server.RemoteObject;
|
||||
import java.rmi.server.RemoteCall;
|
||||
import java.rmi.server.UnicastRemoteObject;
|
||||
import java.rmi.server.Operation;
|
||||
import java.rmi.server.ObjID;
|
||||
import java.rmi.server.UID;
|
||||
import java.lang.reflect.Method;
|
||||
import java.io.ObjectOutput;
|
||||
import java.io.ObjectInput;
|
||||
import java.io.IOException;
|
||||
import java.net.Socket;
|
||||
import java.net.InetAddress;
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectInput;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.ObjectOutput;
|
||||
import java.io.ObjectOutputStream;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.rmi.Remote;
|
||||
import java.rmi.RemoteException;
|
||||
import java.rmi.server.ObjID;
|
||||
import java.rmi.server.Operation;
|
||||
import java.rmi.server.RMIClientSocketFactory;
|
||||
import java.rmi.server.RemoteCall;
|
||||
import java.rmi.server.RemoteObject;
|
||||
import java.rmi.server.RemoteRef;
|
||||
import java.rmi.server.UID;
|
||||
|
||||
public class UnicastRef
|
||||
implements RemoteRef, ProtocolConstants {
|
||||
|
@ -73,8 +65,9 @@ UnicastConnectionManager manager;
|
|||
/**
|
||||
* Used by serialization, and let subclass capable of having default constructor
|
||||
*/
|
||||
//private
|
||||
UnicastRef() {
|
||||
// must be public otherwise java.rmi.RemoteObject cannot instantiate this class
|
||||
// -- iP
|
||||
public UnicastRef() {
|
||||
}
|
||||
|
||||
public UnicastRef(ObjID objid, String host, int port, RMIClientSocketFactory csf) {
|
||||
|
@ -90,7 +83,10 @@ public Object invoke(Remote obj, Method method, Object[] params, long opnum) thr
|
|||
// Check if client and server are in the same VM, then local call can be used to
|
||||
// replace remote call, but it's somewhat violating remote semantic.
|
||||
Object svrobj = manager.serverobj;
|
||||
if(svrobj != null){
|
||||
|
||||
// Make sure that the server object is compatible. It could be loaded from a different
|
||||
// classloader --iP
|
||||
if(svrobj != null && method.getDeclaringClass().isInstance(svrobj)){
|
||||
//local call
|
||||
Object ret = null;
|
||||
try{
|
||||
|
|
Loading…
Add table
Reference in a new issue