Hello,
I am working on the B&S assignment and have finised and tested the database server classes. Everything works fine, but as I am finishing up the documentation of these classes a few alerts popped up in my head.
1) I am using a timeout in my lock method, but am not sure if my specs allow me to.
Here is the spec of my lock method
// Locks a record so that it can only be updated or deleted by this client.
// Returned value is a cookie that must be used when the record is unlocked,
// updated, or deleted. If the specified record is already locked by a different
// client, the current thread gives up the CPU and consumes no CPU cycles until
// the record is unlocked.
But since I have a timeout, I had to change the last sentence in the documentation of the lock method of the DBAccess interface to the following
until the record is unlocked or the maximum waiting time has
elapsed, whichever happens first.
Should I not use the timeout in my locking because this breaks my specs or could I get away it by argumenting my choice in the 'choices.txt'?
2) I have a connection factory that creates a new connection for every client using a shared instance of a TableFileManager and TableLockManager. Both those *Manager classes are
thread safe, but the connection objects
themselves not, so each connection should be used by a single thread only. I have documented this in the javadoc. Is this allowable or should I make my connection objects themselves thread safe too, so they could be used for example in a connection pool?
I would really appreciate your suggestions on this matter.
Thanks in advice.
Luc Feys