(Quick Reference)
withOptimisticLock
Purpose
withOptimisticLock
method provides an easy way to use a optimistic lock.
Examples
sampleDomain.withOptimisticLocking(modificationBaseVersion, [errorBinding: true]) { Object domain -> // Operations which might causes OptimisticLockingFailureException
.
// Here is invoked only when a version of modification base < current persistent version.}.onConflict { Object domain, Throwable caused -> // Operations to handle a failure of optimistic locking
// e.g. to render edit page to re-input
}
Description
See also
Optimistic Locking.