I do check first for x to be in my map of locked records and also if the cookie that was passed is the same stored in my map for x,
if this is true I do remove the value in my map for x and call notifyAll().
If not if x is in my map but the cookie passed as argument is not
I throw a SecurityException.
if not I check if the record x does not exist
and if this the case I throw RecordNotFoundException.
that's it !
Thanks for that hint, the problem was, that I firstly validated the recNo with the possible consequence of a RNFE being thrown and after that I did cookie matching. Reversing validation logic will resolve this.
In my own created interface update, delete and unlock methods don't throw the RNFE anymore, because it makes no sense at all. You have to always lock the record prior to updating/deleting/unlocking, so when record doesn't exist anymore you will get the RNFE when you lock the record. When you successfully have locked a record, it can't disappear mysteriously
This approach simplifies again my code: I don't have to catch any RNFE which will never happen. But you won't be a fan, because you are a Beckenrandschwimmer and are afraid of the automatic failure ghost ;)
you're right, RNFE in those methods don't make much sense anymore having logical locking.
After a record is locked, a record shouldn't vanish mysteriously, except
that a mean guy accesses and manipulates the database file meanwhile or
due to some magnetic or mechanical failure the record flag on hard disk turns to an invalid one.
But that's actually a stupid "Beckenrandschwimmer" argument ;-).
You like that word, don't you ?
To improve your German further, I'll tell you some more synonyms for that, i.e. :
Andy Jung wrote:To improve your German further, I'll tell you some more synonyms for that, i.e.
Because in Belgium there are 3 official languages (dutch, french and german) I had to learn 4 languages (the 3 official ones + english of course). In our 1st German lesson we learnt the word "Tempotaschentucher". I never forgot that one, so funny After all Dutch and German are closely related to each other.
Joined: Feb 07, 2010
I know, the best foreign language speakers in Europe are people from small countries like Belgium, Denmark, Holland ...
Germans are a little bit like the English: There's actually no really need to learn a foreign language.
This is why most Germans are pretty bad in the English language (like me).