|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.basex.core.DBLocking
public final class DBLocking
Manage read and write locks on arbitrary strings. Maximum of MainProp.PARALLEL
concurrent transactions are allowed, further will be queued.
This class prevents locking deadlocks by sorting all all strings
Locks can only be released and downgraded by the same thread which acquired it.
Locking methods are not synchronized to each other. The user must make sure not to call
them in parallel by the same thread (it is fine to call arbitrary locking methods by
different threads at the same time).
This locking can be deactivated by setting MainProp.GLOBALLOCK
to true
.
Field Summary | |
---|---|
static java.lang.String |
ADMIN
Special lock identifier for administrative commands. |
static java.lang.String |
BACKUP
Special lock identifier for backup commands. |
static java.lang.String |
COLL
Special lock identifier for current document, will be substituted. |
static java.lang.String |
CTX
Special lock identifier for current context, will be substituted. |
static java.lang.String |
EVENT
Special lock identifier for event commands. |
static java.lang.String |
REPO
Special lock identifier for repository commands. |
static java.lang.String |
USER_PREFIX
Prefix for user defined locks. |
Constructor Summary | |
---|---|
DBLocking(MainProp mp)
Initialize new Locking instance. |
Method Summary | |
---|---|
void |
acquire(Proc pr,
StringList read,
StringList write)
Puts read and write locks the specified databases. |
void |
downgrade(StringList write)
Only keeps given write locks, downgrades the others to read locks. |
void |
release(Proc pr)
Unlock all string locked by a transaction. |
java.lang.String |
toString()
Present current locking status. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String COLL
public static final java.lang.String CTX
public static final java.lang.String ADMIN
public static final java.lang.String BACKUP
public static final java.lang.String EVENT
public static final java.lang.String REPO
public static final java.lang.String USER_PREFIX
Constructor Detail |
---|
public DBLocking(MainProp mp)
mp
- Main properties, used to read parallel transactions limit.Method Detail |
---|
public void acquire(Proc pr, StringList read, StringList write)
Locking
token
for unlocking these objects again.
acquire
in interface Locking
pr
- processread
- names of databases to put read locks on.
Global locking is performed if the passed on reference is null
write
- names of databases to put write locks on.
Global locking is performed if the passed on reference is null
public void downgrade(StringList write)
downgrade
in interface Locking
write
- write locks to keeppublic void release(Proc pr)
Locking
release
in interface Locking
pr
- processpublic java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |