Win a copy of Node.js Design Patterns: Design and implement production-grade Node.js applications using proven patterns and techniques this week in the Server-Side JavaScript and NodeJS forum!
    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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Server Design, Please Comment !!

Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Hi guys,
I have nearly completed the assignment and I hope to submit it within this month. I am listing below the design choices regarding the server. Feel free to comment on any part of the design.
Server Design
Note: Both Data class and RemoteData class implement the DataInterface interface. The RemoteData class has the same public method as the Data class, it contains a single instance of Data class. Each of the methods in RemoteData simply pass on the request to the Data class instance.
1. Used RMI over serialization and sockets. No dynamic class downloading is used (although the app works fine with a code base specification and the stub class only on the server side.)
2. Implemented lock/unlock by changing the signature of the lock and unlock methods in the database. An additional method unlockAll() is also added to the Data class, which is invoked whenever the RemoteData class is unreferenced. This method is not included in the DataInterface so it cannot be invoked by the clients.
3. lock and unlock method use client ID to keep track of the lock and unlock operation.
4. No timeout supported for the record locks (since it introduced more issues than it solved).
5. No two clients/threads are allowed to access the low level database file at a time. Each thread has to obtain a mutex lock on the database file instance db before accessing it. So in this way I have implemented thread safety in my Data class. Each of methods of the data class has been modified to implement the sunchronization of the mutex object.
6. When running in networked mode the DataServer class creates a single instance of RemoteData class for each file and binds them to the RMI registry, which can be looked up by the client.
7. Record/Database locks are kept in a HashTable with the record number as the key and the clientID as the value. Since there is only one instance of Data class for each data file so I have implemented the lock/unlock algorithm in the Data class itself. So each clients request to lock/unlock a record is handled properly by the unlock and lock methods of the data class itself.
8. Implemented a complete GUI for the server, complete with menu bar and toolbar and a pane to show messages. I did this because the instructions say that the program should run in a production version i.e. the JRE 2 edition of java. This edition does not permits any output to be routed to the console so a gui is a definite requirement. Although no definite requirement has been directly made in the instructions but the production clause in the instructions simply routed me towards this.

I have tested the FBN assignment on a local computer and in a local area network. It works without any problem and hiccups. However I have no idea as to how to check this over internet with client on one computer at a given location and the server on a different comptuer in another geographically different location.
Any suggetions are always welcome
Posts: 17346
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Since you have a response in your other post of the same name on the same topic, I am closing this one, so you only have to look at one thread.
Weeds: because mother nature refuses to be your personal bitch. But this tiny ad is willing:
Thread Boost feature
    Bookmark Topic Watch Topic
  • New Topic