• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to create RemoteData?

 
Frank Liu
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Nate Johnson:
main
1) create a "local" database on the server (Data)
2) pass that ref to my RemoteDataFactory (constructor) so it can keep a copy when getConn is called on it (which it turn creates a new RemoteData based on that database)
3) bind that RemoteDataFactory to the registry
end main
So, now in the client, get a ref to RemoteDataFactory (from Naming) when a remote connection is requested and call getConn. This will return a RemoteData object that has all of the methods that can access that "local" Data that was created back on the server. Each client can do this when it starts in remote mode and then be talking to the same Data, but with a unique RemoteData (which in turn can be used as the id for locking).

I just want to know how to "creates a new RemoteData based on that database".
RemoteData can't get the ref of database(Data) from its constructor.
public RemoteData(Data data) can't work for Data can't be Serialized,then how can I use Data in the RemoteData?How can I pass the ref in the RemoteDataFactory to the RemoteData?
 
Frank Liu
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
my getRomoteData() in RemoteDataFactory is like this:
public DataInterface getRemoteData() throws RemoteException {
DataInterface remoteData = null;
try{
remoteData = new RemoteData(data);
//data is an instance of Data.
}
catch(Exception e){
e.printStackTrace();
}
return remoteData;
}
and RemoteData is something like:
public class RemoteData implements DataInterface,Remote{
private DataInterface data;
public RemoteData(DataInterface data) throws RemoteException,IOException{
this.data = data;
}
....
}
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic