com.groiss.store
Class Lock

java.lang.Object
  extended by com.groiss.store.PersistentObject
      extended by com.groiss.store.Lock
All Implemented Interfaces:
KeyValuePair<java.lang.Object,java.lang.Object>, Persistent, java.io.Serializable, java.lang.Cloneable

public class Lock
extends PersistentObject

Make a database lock.

See Also:
Serialized Form

Field Summary
static java.lang.String MAILBOX_LOCKNAME
           
 
Fields inherited from class com.groiss.store.PersistentObject
filled, oid
 
Constructor Summary
  Lock()
           
protected Lock(long obj, java.lang.String lockname)
           
 
Method Summary
 java.util.Date getLockdate()
           
 java.lang.String getLockname()
           
 java.lang.String getNodeid()
           
 long getObj()
           
 java.lang.String getTableName()
          This method must return the table name of the database table in which this persistent object is stored.
static boolean isLocked(long obj, java.lang.String lockname)
          Returns true if the specified lock exists for the passed object, false otherwise.
static void lock(long obj, java.lang.String lockname)
          Try to make a database lock.
static void unlock(long obj, java.lang.String lockname)
          Remove the lock.
 
Methods inherited from class com.groiss.store.PersistentObject
clone, dbFields, equals, getKey, getOid, getStore, getValue, hashCode, isFilled, onDelete, onInsert, onRead, onUpdate, setFilled, setOid, setStore
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAILBOX_LOCKNAME

public static final java.lang.String MAILBOX_LOCKNAME
See Also:
Constant Field Values
Constructor Detail

Lock

public Lock()

Lock

protected Lock(long obj,
               java.lang.String lockname)
Method Detail

getLockdate

public java.util.Date getLockdate()

getLockname

public java.lang.String getLockname()

getNodeid

public java.lang.String getNodeid()

getObj

public long getObj()

getTableName

public java.lang.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,
                        java.lang.String lockname)
Try to make a database lock.

Parameters:
obj - the oid of an object to lock
lockname -

unlock

public static void unlock(long obj,
                          java.lang.String lockname)
Remove the lock.

Parameters:
obj - the locked object
lockname - the name of the lock

isLocked

public static boolean isLocked(long obj,
                               java.lang.String lockname)
                        throws java.lang.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 object
lockname - the name of the lock
Returns:
true if the specified lock exists for the given object; else instead
Throws:
java.lang.Exception


@enterprise 8.0.22989 Copyright © 2001-2017 Groiss Informatics GmbH. All Rights Reserved.