com.groiss.store
Class Lock
java.lang.Object
com.groiss.store.PersistentObject
com.groiss.store.Lock
- All Implemented Interfaces:
- KeyValuePair<Object,Object>, Persistent, Serializable, Cloneable
public class Lock
- extends PersistentObject
Make a database lock.
- See Also:
- Serialized Form
| Methods inherited from class com.groiss.store.PersistentObject |
clone, dbFields, equals, getKey, getOid, getStore, getValue, hashCode, isFilled, onDelete, onInsert, onRead, onUpdate, setFilled, setOid, setStore |
MAILBOX_LOCKNAME
public static final String MAILBOX_LOCKNAME
- See Also:
- Constant Field Values
Lock
public Lock()
Lock
protected Lock(long obj,
String lockname)
getLockdate
public Date getLockdate()
getLockname
public String getLockname()
getNodeid
public String getNodeid()
getObj
public long getObj()
getTableName
public String getTableName()
- Description copied from interface:
Persistent
- This method must return the table name of the database table in which
this persistent object is stored.
- Returns:
- The table name of the database table in which this persistent
object is stored.
lock
public static void lock(long obj,
String lockname)
- Try to make a database lock.
- Parameters:
obj - the oid of an object to locklockname -
unlock
public static void unlock(long obj,
String lockname)
- Remove the lock.
- Parameters:
obj - the locked objectlockname - the name of the lock
isLocked
public static boolean isLocked(long obj,
String lockname)
throws Exception
- Returns true if the specified lock exists for the passed object, false otherwise.
Note: there is some uncertainty in the answer because if another thread did call
lock(long, String) before you call this method but did not commit already, this method
will return false allthough a subsequent call of lock(long, String)
would cause an Exception.
If you want to lock an object, do not call this method before calling lock(long, String)
but call lock(long, String) directly which is guaranteed to be not successfull if a lock
already exists.
- Parameters:
obj - the locked objectlockname - the name of the lock
- Returns:
true if the specified lock exists for the given object; else instead
- Throws:
Exception
@enterprise 8.0.10809 Copyright © 2001-2012 Groiss Informatics GmbH. All Rights Reserved.