public final class DBLocking extends Object implements Locking
StaticOptions.PARALLEL
concurrent transactions are allowed,
further will be queued.
This class prevents locking deadlocks by sorting all all strings
Locks can only be released 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 StaticOptions.GLOBALLOCK
to
true
.Modifier and Type | Field and Description |
---|---|
static String |
ADMIN
Special lock identifier for administrative commands.
|
static String |
BACKUP
Special lock identifier for backup commands.
|
static String |
COLL
Special lock identifier for collection available via current context; will be substituted.
|
static String |
CTX
Special lock identifier for database opened in current context; will be substituted.
|
static String |
EVENT
Special lock identifier for event commands.
|
static String |
MODULE_PREFIX
Prefix for locks in Java modules.
|
static String |
REPO
Special lock identifier for repository commands.
|
static String |
USER_PREFIX
Prefix for user defined locks.
|
Constructor and Description |
---|
DBLocking(StaticOptions sopts)
Initialize new Locking instance.
|
Modifier and Type | Method and Description |
---|---|
void |
acquire(Proc pr,
StringList read,
StringList write)
Puts read and write locks the specified databases.
|
void |
release(Proc pr)
Unlock all string locked by a transaction.
|
String |
toString()
Present current locking status.
|
public static final String COLL
public static final String CTX
public static final String ADMIN
public static final String BACKUP
public static final String EVENT
public static final String REPO
public static final String USER_PREFIX
public static final String MODULE_PREFIX
public DBLocking(StaticOptions sopts)
sopts
- static optionspublic void acquire(Proc pr, StringList read, StringList write)
Locking
token
for unlocking these objects again.public void release(Proc pr)
Locking
Copyright © 2005–2015 BaseX Team. All rights reserved.