ConcurrencyManager Interface Reference

Detailed Description

ConcurrencyManager is used to handle concurrency for objects.

Depending on the lock type, locking has different semantics:

  • Optimistic locks can be aquired on the same object by different users. This lock quarantees that an exception is thrown, if the user tries to persist an object, which another used has updated, since the user retrieved it.
  • Pessimistic (write) locks can be aquired on the same object only by one user. This lock quarantees that no other user can modify the object until the lock is released. A user can only aquire one lock on each object. An exeption is thrown, if a user tries to aquire a lock on an object on which another user already owns a pessimistic lock.
ingo herwig

Definition at line 32 of file ConcurrencyManager.php.

+ Inheritance diagram for ConcurrencyManager:

Public Member Functions

 aquireLock (ObjectId $oid, $type, PersistentObject $currentState=null)
 releaseLock (ObjectId $oid, $type=null)
 releaseLocks (ObjectId $oid)
 releaseAllLocks ()
 getLock (ObjectId $oid)
 checkPersist (PersistentObject $object)
 updateLock (ObjectId $oid, PersistentObject $object)

Member Function Documentation

◆ aquireLock()

aquireLock ( ObjectId  $oid,
PersistentObject  $currentState = null 

Aquire a lock on an ObjectId for the current user.

Throws an exception if locking fails.

$oidThe object id of the object to lock.
$typeOne of the Lock::Type constants.
$currentStatePersistentObject instance defining the current state for an optimistic lock (optional, if not given, the current state will be loaded from the store)

Implemented in DefaultConcurrencyManager.

◆ releaseLock()

releaseLock ( ObjectId  $oid,
  $type = null 

Release a lock on an ObjectId for the current user.

$oidobject id of the object to release.
$typeOne of the Lock::Type constants or null for all types (default: null)

Implemented in DefaultConcurrencyManager.

◆ releaseLocks()

releaseLocks ( ObjectId  $oid)

Release all locks on an ObjectId regardless of the user.

$oidobject id of the object to release.

Implemented in DefaultConcurrencyManager.

◆ releaseAllLocks()

releaseAllLocks ( )

Release all locks for the current user.

Implemented in DefaultConcurrencyManager.

◆ getLock()

getLock ( ObjectId  $oid)

Get the lock for an object id.

$oidobject id of the object to get the lock data for.
Lock instance or null

Implemented in DefaultConcurrencyManager.

◆ checkPersist()

checkPersist ( PersistentObject  $object)

Check if the given object can be persisted.

Throws an exception if not.

$objectThe object to check.

Implemented in DefaultConcurrencyManager.

◆ updateLock()

updateLock ( ObjectId  $oid,
PersistentObject  $object 

Update the current state of the lock belonging to the given object if existing and owned by the current.

$oidThe object id.
$objectThe updated object data.

Implemented in DefaultConcurrencyManager.