Hi
it's mentionned in my exam:
"the user interface must allow the user to search the data for all records, or for records where the name/or location fields exactly match value specified by the user"
Question 1:
so the method should like this
1: int[] a = find (
String[] criteria)
2: for(........) {
3: String[] b = read(int recNo);
4: }
OK! between step 1 and step 3,other clients perhaps change the value! so the result will be error! how can i deal with this situation? only synchrnized this method will not be helpful.
To further divorce the concept between performing a search and displaying data, the search method does not return records - it returns record numbers. You have to retrieve the records based on the numbers in a separate step. So you would presumably be validating that the records still matched anyway (otherwise the records could change between when you complete the search and when you retrieve the record).
It is also helpful to do a complete search because there is a possibility you could get wrong records with the partial search. Consider the following:
1) You find() a bunch of matching records.
2) You read() each record.
But multi-threading, that record could have been changed between the find() and read(), and even though it matched at the time of the find(), it does not match at the time of the read(). How to catch it? With the conveniently required complete search. So come to think of it, the requirements would be incomplete were they not dual this way.
above statements are about the same question that i have mentioned ,who can give some indications.
thanks
[ May 02, 2006: Message edited by: LianGuang Wang ]
[ Nope - not urgent!]
[ May 02, 2006: Message edited by: Barry Gaunt ]