I wondered how have you handled the clients that were waiting for some record to be unlocked when the database is shutdowned.
In my opinion the only two possibilities to wake up the waiting threads are either to use notifyAll or to send them an InterruptedException. Before trying to wait again for the record to be unlocked, the value of a "shutdowned" flag must be read . In case that the flag is set, an exception must come to the client, telling it that the database was shutdowned..
What do you think about this scenario ?
What is the expert opinion : use notify or use InterruptedException. Which one is theoretically better suited for such a cancellation task ?
We deal here with two problems : 1.The close server - waiting clients 2.Crash clients
1.The close server - waiting clients Well the problem is simple that it seams. The sever close process must wait until all the clients are ready with them tasks, more precisely if there are no locked records. If a client tries to gain access to a record and the record is locked the client must wait until the record is free but the client does not lock the record so it is not involved in a transaction - he just wait to be involved. So it is acceptable to end this threads with an exception. Even more precisely if there are waiting threads, this threads must be wake up, so before the you interrupt thread work flow (with an Exception) you must notify the rest of the (possible) waiting threads.
I am not shore if this is part of the exam but I am not so shore. I use RMI and I have th possibility to use the Unref. interface, but I am not so shore about. Any way you must document your decisions so at least you must mention in your choiches.txt how/why/etc with Crashed clients.