org.openorb.ccs.kernel
Class LockSet

java.lang.Object
  extended by org.omg.PortableServer.Servant
      extended by org.omg.CosConcurrencyControl.LockSetPOA
          extended by org.openorb.ccs.kernel.LockSet
All Implemented Interfaces:
org.omg.CORBA.portable.InvokeHandler, LockSetOperations

public class LockSet
extends LockSetPOA

This class provides operatiosn to acquire and release locks

Author:
Marina Daniel

Constructor Summary
LockSet()
           
 
Method Summary
 void change_mode(lock_mode held_mode, lock_mode new_mode)
          Changes the mode of a single lock.
 boolean isLockable(lock_mode mode)
          return whether the current lock mode permits the required lock mode
 void lock(lock_mode mode)
          Acquires a lock on the specified lock set in the specified mode
 void setRelatedLockSet(LockSet related_lockset)
          sets the related lock set
 boolean try_lock(lock_mode mode)
          Attempts to acquire a lock on the specified lock set.
 void unlock(lock_mode mode)
          Drops a single lock on the specified lock set in the specified mode.
 
Methods inherited from class org.omg.CosConcurrencyControl.LockSetPOA
_all_interfaces, _invoke, _this, _this
 
Methods inherited from class org.omg.PortableServer.Servant
_default_POA, _get_delegate, _get_interface_def, _is_a, _non_existent, _object_id, _orb, _poa, _set_delegate, _this_object, _this_object
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LockSet

public LockSet()
Method Detail

lock

public void lock(lock_mode mode)
Acquires a lock on the specified lock set in the specified mode

Parameters:
mode - the specified mode

try_lock

public boolean try_lock(lock_mode mode)
Attempts to acquire a lock on the specified lock set.

Parameters:
mode - The lock mode.
Returns:
True when the lock was successful, false otherwise.

unlock

public void unlock(lock_mode mode)
            throws LockNotHeld
Drops a single lock on the specified lock set in the specified mode.

Parameters:
mode - The lock mode.
Throws:
LockNotHeld - If being called to a lock that is not held.

change_mode

public void change_mode(lock_mode held_mode,
                        lock_mode new_mode)
                 throws LockNotHeld
Changes the mode of a single lock.

Parameters:
held_mode - The current held mode.
new_mode - The new mode.
Throws:
LockNotHeld - Thrown when when no lock is held.

isLockable

public boolean isLockable(lock_mode mode)
return whether the current lock mode permits the required lock mode

Parameters:
mode - the required lock mode
Returns:
true if the lock set can be locked to this mode

setRelatedLockSet

public void setRelatedLockSet(LockSet related_lockset)
sets the related lock set

Parameters:
related_lockset - the related lock set