Singleton implementation of lock manager means by providing all static methods or getInstance() method?
The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
But by having a lockmanger implemented using singleton pattern, am i not limiting my implementation to be just limited to a single datbase file (single table),should i not make a static instance of LockManger in my ConnectionFactory class where i am already making a static instance of Data class which is been passed to all RemoteData objects for database access.Doing the above will allow me in future implementaions have more database files attached to my remote server use a seperate lockmanger for implementing locking in them.
Am i correct in my assumptions above, pls comment as i am confused.Has anybody else followed this kind of approach.
The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
I did not have a lock manager in my final submission.
The persuading argument was that if your client dies ( mourn ) you'd need to have some mechanism of tracking and releasing the lock
How did you handle [locks where the clients died]? Some kind of time-mechanism ( i.e. a background thread sleeps and checks at intervals) ?
SO you'd agree that a LockManager would be ideal to handle releasing of dead client locks ....
SO you'd agree that a LockManager would be ideal ... handling dead-locks ?
I am not sure if deadlock is a database issue. Seems more like a programmer issue.
P.S. I didn't know that RMI had it's own lock and unlock methods. You learn something new everytime.
The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
Does this make sense?
using your extended Data class in local mode is there an unnecessary overhead ? I suspect in this case you used the Data class directly.
The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
What is the problem if you keep lockmanager as singleton?
Data uses LockManager, if provided, and it is a containment relationship(Data has LockManager).
OK?
The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
Technically I had my GUI which connected to a database connection factory which provided either a local or a remote connection. This connection conformed to an interface which defined all the public methods of the Data class.
This sounds like the ConnectionFactory on the client discussed here before.
Did your RMI Factory on the server have to extend UnicastRemoteObject also, seeing as DataRMI did this already ?
...and have Data do file/table level methods only
The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
Did I just use circular logic to explain this?
The question about not binding DataRMI to the registry. I guess you don't want to expose Data to a client directly.
The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
while it's true that your thread IDs become invalide if your client loses connection and unreferenced() get called. But I do believe this is the whole point of using unreferenced() to clean up after dead sessions. This is how most commercial system work, HTTPSession is good example - you time out your session info is gone and you have to relogin (try explaining to Netegrity why your session info should be preserved after you time out ).
Also, I think RMI unreferenced timeout is 10 min or so (I could be wrong about this), if your client has to wait more than a few seconds for a lock there's has to be a bigger problem with the system.
Also, with increasing number of users you instantiate increasing number of objects and consume more and more system resources. That might not be a big deal for Fly By Night (I always thought it was funny how they named the project -- sounds like air carrier's operations system used to launch strikes agains Kabul), it could become a problem when number of user and complexity of objects grow.
Anyway, its a matter of choice
I'd like to know just how much can be added to the Network layer without it getting too unwieldy , if you get my meaning.
For example, if there were another object added to the network layer, say SessionManagementRMI for arguments sake, then would calling Unreferenced at DataRMI also remove references for Session Management ?
It adds to my comfort level if at least 3 other people advocate the same .
The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
I advise against following a particular design just because someone else used it.
Qusay
Instead of making the local connection "appear" to throw the same exceptions as the network, I chose to make the network connection handle all network exceptions internally, so that the GUI never realised that there was a network problem. Once again this fits into my philosophy of trying to hide anything that might be specific to a particular network interface.
Technically I had my GUI which connected to a database connection factory which provided either a local or a remote connection. This connection conformed to an interface which defined all the public methods of the Data class.
When the GUI requested a local connection from the connection factory, it returned an instance of a wrapper class for the Data class. The reason for the wrapper was just because I didnt want to change the Data class to implement my interface. I could have done so just as easily though.
Qusay
The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
Qusay
Qusay
The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
Qusay
The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
Qusay
It's hard to fight evil. The little things, like a nice sandwich, really helps. Right tiny ad?
New web page for Paul's Rocket Mass Heaters movies
https://coderanch.com/t/785239/web-page-Paul-Rocket-Mass
|