I'm learning the H2 sourcecode,and here is the code that I have a question.
/**
* Update the value for the given key.
* <p>
* If the row is locked, this method will retry until the row could
be
* updated or until a lock timeout.
*
* @param key the key
* @param value the new value (not null)
* @return the old value
* @throws IllegalStateException if a lock timeout occurs
*/
public V put(K key, V value) {
DataUtils.checkArgument(value != null, "The value may not be
null");
return set(key, value);
}
private V set(K key, V value) {
transaction.checkNotClosed();
V old = get(key);
boolean ok = trySet(key, value, false);
if (ok) {
return old;
}
throw DataUtils.newIllegalStateException(
DataUtils.ERROR_TRANSACTION_LOCKED, "Entry is locked");
}
The comment says " If the row is locked, this method will retry until the
row could be updated or until a lock timeout", but i dont see the retry or
the timeout detect, is the comment wrong?
personally, I think If the row is locked, this method should retry. IF not,
only try 1 time, the data is lost.I am not sure if my understanding is
right.Really hope to be answered.
Really appreciated !
--
You received this message because you are subscribed to the Google Groups "H2
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.