Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Data Object creation in Remote Mode!

 
Vikas Sood
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Mark,
I am using a connection factory to create an instance per client of RemoteData for remote access.
I am using creating an instance of Data like this:
private static Data data=new Data("db.db");
What i understand from my experience that this way i have created a globally available instance of Data,which is assigned a new instance of Data class the first time the RemoteData class is loaded on to the jvm.Am i right? I am a bit confused ! If what i am sugessting is right then i am going to have just one instance of Data for all my RemoteData instances.
Kindly comment.
VikasSood
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That is basically correct, you pass the reference to that Data instance to the DataAccessRemote class that gets created and passed to the client. And yse that way there is one and only one Data class instance and each client ahs their own DataAccessRemote class.
Mark
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic