Aruna A. Raghavan<br />SCJP, SCJD, SCWCD
Aruna A. Raghavan<br />SCJP, SCJD, SCWCD
Aruna A. Raghavan<br />SCJP, SCJD, SCWCD
Aruna A. Raghavan<br />SCJP, SCJD, SCWCD
Aruna A. Raghavan<br />SCJP, SCJD, SCWCD
Aruna A. Raghavan<br />SCJP, SCJD, SCWCD
Peter den Haan | peterdenhaan.com | quantum computing specialist, Objectivity Ltd
Peter den Haan | peterdenhaan.com | quantum computing specialist, Objectivity Ltd
Aruna A. Raghavan<br />SCJP, SCJD, SCWCD
Aruna A. Raghavan<br />SCJP, SCJD, SCWCD
Aruna A. Raghavan<br />SCJP, SCJD, SCWCD
One more thing.
clearLocks() does not look too safe. It is accessing the map that some one else may have locked.
Aruna A. Raghavan<br />SCJP, SCJD, SCWCD
My pleasure. You may have gotten more than you bargained forOriginally posted by Aruna Raghavan:
Thanks very much for reviewing it.
You can't, I was unclear, my apologies. The only static finals I'd proposed is DATABASE_LOCK and DATABASE_LOCK_KEY. You can make mapLocks final, but not static.1) I don't know if I can make the data in LockManager static final.
It boils down to a design choice: if and how do you handle interrupts?3) About InterruptedExceptions - I would like to tell the client something got hosed when this happens so I can display an error message. So I throw it from the LockManager to Connection. My DataFacade handles it. Are there any better ways to handle it?
Yes. And the nice thing of having an Object there is that LockManager loses all dependency on the FBN project -- it becomess a pretty generic implementation of a certain type of locking semantics.4) Regarding using FBNDataInterface type for clientID - I think you are saying that it can just be a plain java Object ref, doesn't even have to be FBNDataInterface. Did I understand it correct?
This has already been answered: it's safe because it's synchronized like anything else manipulating the Map.clearLocks() does not look too safe. It is accessing the map that some one else may have locked. Shouldn't it wait till every one else is done using it?
Peter den Haan | peterdenhaan.com | quantum computing specialist, Objectivity Ltd
Aruna A. Raghavan<br />SCJP, SCJD, SCWCD
Doesn't it automatically do the latter, as the database lock is in many ways just another lock in the map? I think I mentioned the notifyAll() at the end of my first response, above.Originally posted by Aruna Raghavan:
But clearLock() should also check for wholeDBLocked flag and also do a notifyAll() I think.
Peter den Haan | peterdenhaan.com | quantum computing specialist, Objectivity Ltd
You can make mapLocks final, but not static.
As LockManager doesn't keep track of the Data it belongs to, you need one LockManager (and one mapLocks) for each Data instance. Making mapLocks static would introduce a completely arbitrary, unnecessary and crippling restriction in your design, namely that you could only ever have one networked Data instance per JVM.Originally posted by Kevin Cao:
Can you explain why [mapLocks can be final, but not static]? The mapLocks will keep track of all the records that are locked at any given time, should it be a class level variable?
Peter den Haan | peterdenhaan.com | quantum computing specialist, Objectivity Ltd
Did you see how Paul cut 87% off of his electric heat bill with 82 watts of micro heaters? |