Re: Distributed Computing confusion

Hi Doug,
 
> > If the argument to DataReference.setData(Data d) on the server
> > is a FieldImpl, then you should be able to cast the return value
> > of DataReference.getData() to FieldImpl.  That is, moving data
> > from the server to the client does not change its class to
> > Remote*.
> >
>
> What you said reaffirms what I thought, but it's not working in
> practice. Here's some sample code that shows the problem. I get the
> problem on both Linux and NT.
 
My statement was wrong - sorry about that.  Now that I look at
the getData() method of RemoteDataReferenceImpl, it does convert
a FieldImpl to a RemoteFieldImpl.
 
The fix is simple.  Replace:
 
  FieldImpl field = (FieldImpl) ref.getData();
 
by:
 
  FieldImpl field = (FieldImpl) ref.getData().local();
 
in your Client.java.
 
Note that RemoteDataReferenceImpl.getData() includes:
 
  if (data instanceof FieldImpl) {
    boolean return_copy = false;
    if (return_copy) {
      return data;
    }
    else {
      return new RemoteFieldImpl((FieldImpl) data);
    }
  }
  else {
    return data;
  }
 
The idea is that applications can extend RemoteDataReferenceImpl
and override getData() to decide on some basis whether to return
the FieldImpl (immediate download to the client), or a
RemoteFieldImpl (a remote reference that the client can download
piecemeal via getSample() calls, etc).
 
I am glad to see VisAD's distributed objects getting used.

Cheers,
Bill
----------------------------------------------------------
Bill Hibbard, SSEC, 1225 W. Dayton St., Madison, WI  53706
hibbard@xxxxxxxxxxxxxxxxx  608-263-4427  fax: 608-263-6738
http://www.ssec.wisc.edu/~billh/vis.html