|
deegree 2.5 (2011/06/29 09:44 build-8-official) | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.deegree.io.datastore.LockManager
public class LockManager
Keeps track of all persistent features that are in a locked state, i.e. a LockFeature
request has been issued
to lock them.
Locked features cannot be updated or deleted except by transactions that specify the appropriate lock identifier.
The LockManager
also ensures that active locks survive a restart of the VM - therefore it keeps
serialized and up-to-date versions of all active Lock
instances in a temporary directory. The directory is
specified by the java.io.tmpdir
system property. On first initialization, i.e. the first call to
getInstance()
, the directory is scanned for all files matching the pattern deegree-lock*.tmp
,
and these are deserialized to rebuild the LockManager
's status.
Method Summary | |
---|---|
Lock |
acquireLock(LockFeature request,
java.util.List<FeatureId> fidsToLock)
Acquires a lock for the given LockFeature request. |
static LockManager |
getInstance()
Returns the only instance of LockManager . |
java.lang.String |
getLockId(FeatureId fid)
Returns the id of the lock that locks the specified feature (if it is locked). |
static void |
initialize(java.io.File workingDir)
Initializes the LockManager . |
boolean |
isLocked(FeatureId fid)
Returns whether the specified feature is locked. |
void |
releaseLock(Lock lock)
Releases the given lock completely (all associated features are unlocked) and removes it (also from the temporary directory). |
void |
releaseLock(java.lang.String lockId)
Releases the specified lock completely (all associated features are unlocked) and removes it (also from the temporary directory). |
void |
releaseLockPartly(java.lang.String lockId,
java.util.Set<FeatureId> unlockFids)
Releases the specified lock partly (all specified features are unlocked). |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Method Detail |
---|
public static void initialize(java.io.File workingDir) throws DatastoreException
LockManager
.
workingDir
- directory where the LockManager
will persists its locks
DatastoreException
public static LockManager getInstance()
LockManager
.
LockManager
public boolean isLocked(FeatureId fid)
fid
- id of the feature
public java.lang.String getLockId(FeatureId fid)
fid
- id of the feature
public Lock acquireLock(LockFeature request, java.util.List<FeatureId> fidsToLock) throws DatastoreException
LockFeature
request. The affected feature instances and their descendant
features + super features have to be specified as well.
If the lockAction in the request is set to ALL and not all requested features could be locked, a
DatastoreException
will be thrown.
If no features have been locked at all, a lock will be issued, but the lock is not registered (as requested by the WFS spec.).
request
- LockFeature
requestfidsToLock
- all feature instances that are affected by the request
DatastoreException
public void releaseLock(java.lang.String lockId) throws DatastoreException
lockId
- lock identifier
DatastoreException
public void releaseLock(Lock lock)
lock
- lock to be releasedpublic void releaseLockPartly(java.lang.String lockId, java.util.Set<FeatureId> unlockFids) throws DatastoreException
If there are no more features associated with the lock, the lock is removed.
lockId
- lock identifierunlockFids
- features to be unlocked
DatastoreException
public java.lang.String toString()
toString
in class java.lang.Object
|
deegree 2.5 (2011/06/29 09:44 build-8-official) | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
an open source project founded by lat/lon, Bonn, Germany.
For more information visit: http://www.deegree.org