public class OptimisticLockException extends Exception
In contrast to pessimistic locking, optimistic locking does not acquire any locks or perform other measures to quarantee mutual exclusion. Rather it keepts track of the entity version it last read from the database and upon a modification, it expects the entity version in the database to remain the same.
Once a modification is performed, the version is then incremented. If the expected version does not match
the actual version, the operation is aborted and an OptimisticLockException
is thrown.
This yields is a highly performant and highly scaleble system as long as concurrent modifications are rare. The downsice of this approach is, that modification have to be retried once an error is detected. However most of the time this overhead is quite bearable.
Constructor and Description |
---|
OptimisticLockException()
Creates a new instance without any reference to another error.
|
OptimisticLockException(String message,
Throwable cause)
Creates a new instance with a reference to the given cause.
|
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
Copyright © 2018. All rights reserved.