LockMode lockMode,
SearchMode searchMode)
throws DatabaseException {
if (!isSerializableIsolation(lockMode)) {
LockType lockType = getLockType(lockMode, false);
KeyChangeStatus result = searchAllowPhantoms
(key, data, lockType, lockType, searchMode);
return result.status;
}
/* Perform range locking to prevent phantoms and handle restarts. */
while (true) {
try {
/* Do not use a range lock for the initial search. */
LockType searchLockType = getLockType(lockMode, false);
/* Switch to a range lock when advancing forward. */
LockType advanceLockType = getLockType(lockMode, true);
/* Do not modify key/data params until SUCCESS. */
DatabaseEntry tryKey = new DatabaseEntry
(key.getData(), key.getOffset(), key.getSize());
DatabaseEntry tryData = new DatabaseEntry