org.springframework.datastore.engine
Class LockableEntityPersister
java.lang.Object
org.springframework.datastore.engine.EntityPersister
org.springframework.datastore.engine.LockableEntityPersister
- All Implemented Interfaces:
- EntityInterceptorAware, Persister
- Direct Known Subclasses:
- AbstractKeyValueEntityPesister
public abstract class LockableEntityPersister
- extends EntityPersister
Interface for entity persisters that support locking
- Since:
- 1.0
Method Summary |
abstract boolean |
isLocked(Object o)
Return whether an object is locked or not |
abstract Object |
lock(Serializable id)
Locks an object for the given identifier returning the locked instance |
abstract Object |
lock(Serializable id,
int timeout)
Acquire a lock using the given identifier and timeout delay |
abstract void |
unlock(Object o)
Unlocks a locked object |
Methods inherited from class org.springframework.datastore.engine.EntityPersister |
addEntityInterceptor, createEntityAccess, delete, delete, deleteEntities, deleteEntity, getMappingContext, getObjectIdentifier, getPersistentEntity, getProxyFactory, getType, persist, persist, persistEntities, persistEntity, retrieve, retrieveAll, retrieveAll, retrieveAllEntities, retrieveAllEntities, retrieveEntity, setEntityInterceptors |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DEFAULT_TIMEOUT
public static int DEFAULT_TIMEOUT
LockableEntityPersister
public LockableEntityPersister(MappingContext mappingContext,
PersistentEntity entity,
Session session)
lock
public abstract Object lock(Serializable id)
throws org.springframework.dao.CannotAcquireLockException
- Locks an object for the given identifier returning the locked instance
- Parameters:
id
- The identifier
- Returns:
- The locked object
- Throws:
org.springframework.dao.CannotAcquireLockException
- Thrown if a lock couldn't be acquired before the default timeout elapsed
lock
public abstract Object lock(Serializable id,
int timeout)
throws org.springframework.dao.CannotAcquireLockException
- Acquire a lock using the given identifier and timeout delay
- Parameters:
id
- the identifiertimeout
- the amount of time to wait before giving up
- Returns:
- The locked object
- Throws:
org.springframework.dao.CannotAcquireLockException
isLocked
public abstract boolean isLocked(Object o)
- Return whether an object is locked or not
- Parameters:
o
- The object
- Returns:
- True if it is locked
unlock
public abstract void unlock(Object o)
- Unlocks a locked object
- Parameters:
o
- The object to unlock