classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: rmi vs cajo


From: Mark Wielaard
Subject: Re: rmi vs cajo
Date: Sun, 30 Oct 2005 15:03:32 +0100

Hi,

Another old patch.

On Sun, 2005-09-11 at 21:40 +0200, Mark Wielaard wrote:
> It seems we are to eager to export the Remote object immediately (from
> the constructor). We want to put it in a Hashtable and call hasCode(),
> but for the cajo Remote object the item field used to calculate the
> hashCode() hasn't been set yet so that gives a NullPointerException.
> 
> Looking at the code I think we might actually want a IdentityHashMap
> here that uses the System.identityHashCode() for an object since we
> are not really interested in equal objects here.

Since people agreed this at least seemed like the correct way to go I
have committed it as follows:

2005-10-30  Mark Wielaard  <address@hidden>

        * gnu/java/rmi/server/UnicastServer.java (refcache): Make it a
        synchronized IdentityHashMap.

We still cannot reliably run cajo. But at least we now have a fighting
chance.

Cheers,

Mark

> Index: gnu/java/rmi/server/UnicastServer.java
> ===================================================================
> RCS file: 
> /cvsroot/classpath/classpath/gnu/java/rmi/server/UnicastServer.java,v
> retrieving revision 1.9
> diff -u -r1.9 UnicastServer.java
> --- gnu/java/rmi/server/UnicastServer.java      2 Jul 2005 20:32:14 -0000     
>   1.9
> +++ gnu/java/rmi/server/UnicastServer.java      11 Sep 2005 19:37:57 -0000
> @@ -51,13 +51,16 @@
>  import java.rmi.ServerError;
>  import java.rmi.server.ObjID;
>  import java.rmi.server.UID;
> +import java.util.Collections;
> +import java.util.Map;
>  import java.util.Hashtable;
> +import java.util.IdentityHashMap;
>  
>  public class UnicastServer
>         implements ProtocolConstants {
>  
>  static private Hashtable objects = new Hashtable();  //mapping OBJID to 
> server ref
> -static private Hashtable refcache = new Hashtable(); //mapping obj itself to 
> server ref
> +static private Map refcache = Collections.synchronizedMap(new 
> IdentityHashMap()); //mapping obj itself to server ref
>  static private DGCImpl dgc;
>  
>  public static void exportObject(UnicastServerRef obj) {

Attachment: signature.asc
Description: This is a digitally signed message part


reply via email to

[Prev in Thread] Current Thread [Next in Thread]