Hi Mark,
Thanks,
first, criteriaFind is a separate method. Not like find at all. so you don't want to overload that method.
yes! I agree. But after get columnName and ColumnVaule from
String criteria(I store them into
a Hashtable), I need to call a function. As this function looks like find method, I overload it. please see following code:
public DataInfo[] criterFind(String criteria) throws DatabaseException {
...
return find(pairsTable);
}
}
private synchronized DataInfo[] find(Hashtable pairsTable) throws DatabaseException {}
This is why I overload find. I don't know why use
synchronized ?
second. For lock file, the only time lock is called with -1 is when the server is about to shutdown, and you want to close the database.
Yes! I agree. Normally lock file only happened when you want to close the database or you want to change the database structure(we have no requirements for it).
Your algorith of getting unlocked records, locking them and waiting for other records that are locked by clients to be unlocked is good. Try to use the ArrayList object instead of Vector.
Yes! ArrayList is fast then Vector. the main difference between them is that Vector is synchronized. because we use Vector m_lock as lock. see code:
public void lock(int record) throws IOException {
synchronized(m_lock){...
}. it seems
Hope that helps
Mark