• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

When is a server not a server?

 
Rowan Brownlee
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all,
I've not written a server before, and I'm wondering if this design constitutes a server as required by the project.
~~~~~~~~~~~
Remote mode
I have a class called Server, which when instantiated simply creates a LockManager object and a ConnectionFactory object and binds LockManager and ConnectionFactory to the RMIRegistry
A client contacts the RMIRegistry to request a Connection object from the ConnectionFactory
A Connection object implements a RemoteDataInterface and has a reference to the LockManager.
A Connection object provides remote access to the database.
LockManager tracks database locks from multiple clients
Once a client has a Connection object, it accesses the database (and the LockManager) via the Connection object.
~~~~~~~~~~~
Server, LockManager, ConnectionFactory and Connection are all separate classes. Server simply launches LockManager and ConnectionFactory, and they provide mechanisms for doing the rest (ie accessing the database, locking and unlocking records).
Am I missing something? Should I have my clients going through the Server to access the ConnectionFactory and LockManager? Or, is it ok for the clients to contact the ConnectionFactory and LockManager directly?
cheerio
Rowan
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When it's a client!
You model looks great. Actually the client is getting a stub to the remote object. SO actually it is calling those methods remotely. And yes what you have called a sever is the server.
Do you start the Registry in your server code? or do you start it from the command line?
Mark
[ February 19, 2002: Message edited by: Mark Spritzler ]
[ February 19, 2002: Message edited by: Mark Spritzler ]
 
Rowan Brownlee
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the RMI correction, Mark. Right now, I'm starting a registry in my server code, though I've not yet thought much about the various command line options.
cheerio
Rowan
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No actually it is better to start it up in code.
What you might find yourself needing is a simple GUI for the server, so that when you want to stop and shutdown the server, you can with a menu option or a button, then you can close the database gracefully. Hint lock(-1).
Mark
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic