Win a copy of Machine Learning for Business: Using Amazon SageMaker and JupyterE this week in the Jython/Python forum
or Object Design Style Guide in the Object-Oriented programming forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
  • Knute Snortum
Sheriffs:
  • Liutauras Vilda
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Joe Ess
  • salvin francis
  • fred rosenberger

Remote & Local mode connection

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear, all-members !
My package structure is as follows;
suncertify : 1. db ; Data.java,
DataInfo.java,
FieldInfo.java,
DatabaseException.java,
db.db
2. server ; DataServer.java(Interface),
Server.java,
ServerImpl.java
3. client ; DataClient.java(Interface),
DataClientGUI.java,
LocalDataClient.java,
RemoteClient.java
TableModel.java
To get a remote & local instance at GUI,
I intend to use following code snippet.
========================================
Data data;
if (local)
data = new LocalDataClient();
else
data = (ServerImpl) Name.lookup(bla bla)
========================================
Can anyone suggest a graceful way to implement it ?
Thanks in advance.
 
ranger
Posts: 17344
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It looks like it is a good implementation. If I had a suggestion to what you might be asking, I'd say put that code into a DataAccessFactory class, that the client main class calls with the necessay parameters.
Mark
 
SungChan Park
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, Mark Spritzler.
It seems that a graceful way to get a instance.
I'll try in that way.
Thanks you very much !
 
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mark,
In the following code snippet.
========================================
Data data;
if (local)
data = new LocalDataClient();
else
data = (ServerImpl) Name.lookup(bla bla)
========================================
Does the rmi server not have to be up and running for the else to work ?
In other words what happens in the following secnario :-
The above client is in local mode and gets the local data connection.
Some other remote client can also connect because the server is up and running.
So would we not have two diffent connections to the database with their own Data objects and hence locking mechanism etc..
Please correct me if i am completely off beat here.
I did search the forum for this ,but still i am not very clear on this topic.
Thanks in advance.
Regards
Suchak Jani
 
Mark Spritzler
ranger
Posts: 17344
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you are in local mode, no other "Client" from somewhere else can use the db.db file, local or remote.
In local mode there is no server.
Mark
 
Suchak Jani
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mark,
In other words i would have three scripts.
1. Start Server Remote
2. Start Client Remote(depends on 1)
3. Start Client Local (independant)
Does the above look Ok.
Regards
Suchak Jani
 
Mark Spritzler
ranger
Posts: 17344
11
Mac IntelliJ IDE Spring
 
Suchak Jani
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I guess now i can change my design.
Thanks Mark
 
First, you drop a couch from the plane, THEN you surf it. Here, take this tiny ad with you:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!