Interface LockManager
- All Known Implementing Classes:
LockManagerImpl
public interface LockManager
Interface defining a manager for locking of objects.
There are currently two modes to a LockManager.
- Where the user has the object and wants it locking. In this case they provide StateManager and we lock it (by a call to the datastore where appropriate).
- Where the user wants to do a find of an object with a particular id. In this case we register the identity as needing this lock level, and the datastore will be called to retrieve the object and will check back what lock level to use.
-
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Method to clear all settings of required lock level.voidclose()Method to close the manager and release resources.getLockMode(Object id) Accessor for what locking should be applied to the object with the specified identity (mode 2).Accessor for the current lock mode for the object managed by the passed StateManager (mode 1).getNextVersion(VersionMetaData vermd, Object currentVersion) Convenience method to provide the next version to use given the VersionMetaData and the current version.voidMethod to lock the object with the provided identity (mode 2).voidlock(DNStateManager sm, LockMode lockMode) Method to lock the object managed by the passed StateManager (mode 1).voidperformOptimisticVersionCheck(DNStateManager sm, VersionStrategy versionStrategy, Object versionDatastore) Method to perform an optimistic version check on the specified StateManager.voidunlock(DNStateManager sm) Method to unlock the object managed by the passed StateManager (mode 1).
-
Method Details
-
lock
Method to lock the object managed by the passed StateManager (mode 1).- Parameters:
sm- StateManager for the objectlockMode- mode for locking
-
unlock
Method to unlock the object managed by the passed StateManager (mode 1).- Parameters:
sm- StateManager for the object
-
getLockMode
Accessor for the current lock mode for the object managed by the passed StateManager (mode 1).- Parameters:
sm- StateManager for the object- Returns:
- The lock mode
-
lock
-
getLockMode
-
clear
void clear()Method to clear all settings of required lock level. -
close
void close()Method to close the manager and release resources. -
performOptimisticVersionCheck
void performOptimisticVersionCheck(DNStateManager sm, VersionStrategy versionStrategy, Object versionDatastore) Method to perform an optimistic version check on the specified StateManager.- Parameters:
sm- StateManagerversionStrategy- The version strategy in useversionDatastore- Version of the object in the datastore
-
getNextVersion
Convenience method to provide the next version to use given the VersionMetaData and the current version.- Parameters:
vermd- Version metadatacurrentVersion- The current version- Returns:
- The next version
- Throws:
NucleusUserException- Thrown if the strategy is not supported.
-