org.exolab.core.foundation
Interface LockServiceIfc


public interface LockServiceIfc

Thew lock service is responsible for manmaging object level locking of PersistentObject instances.

Version:
$Revision: 1.1 $ $Date: 2000/02/22 07:37:55 $
Author:
Jim Alateras

Method Summary
 void acquireExclusiveLock(SessionIfc session, PersistentObject obj)
          Acquire an exclusive lock on the specified object.
 void acquireExclusiveLock(SessionIfc session, PersistentObject obj, long wait)
          Acquire an exclusive lock on the specified object.
 void acquireExclusiveLocks(SessionIfc session, java.util.Enumeration objs)
          Acquire exclusive locks on all the specified PersistentObject(s).
 void acquireExclusiveLocks(SessionIfc session, java.util.Enumeration objs, long wait)
          Acquire exclusive locks on the specified objects.
 void acquireReadLock(SessionIfc session, PersistentObject obj)
          Acquire a read lock on the specified PersistentObject.
 void acquireReadLock(SessionIfc session, PersistentObject obj, long wait)
          Acquire a read lock on the specified PersistentObject.
 void acquireReadLocks(SessionIfc session, java.util.Enumeration objs)
          Acquire read locks on all the specified PersistentObject(s).
 void acquireReadLocks(SessionIfc session, java.util.Enumeration objs, long wait)
          Acquire read locks on the specified PersistentObject(s).
 boolean aquireWriteLock(SessionIfc session, PersistentObject obj)
          Acquire a write lock on the specified PersistentObject.
 boolean aquireWriteLock(SessionIfc session, PersistentObject obj, long wait)
          Acquire a write lock on the specified PersistentObject.
 boolean aquireWriteLocks(SessionIfc session, java.util.Enumeration objs)
          Acquire write locks on all the specified PersistentObject(s).
 boolean aquireWriteLocks(SessionIfc session, java.util.Enumeration objs, long wait)
          Acquire write locks on the specified PersistentObject(s).
 java.util.Enumeration getAllLockedObjects()
          Return an enumeration of all locked object.
 java.util.Enumeration getLockedObjects(SessionIfc session)
          Return the set of objectslocked for the specified session
 boolean isLocked(PersistentObject obj)
          Check whether the specified object is locked
 void releaseAllLocks()
          Release all the locks maintained by the service.
 void releaseLock(PersistentObject obj)
          Release the lock on the specified object.
 void releaseLocks(java.util.Enumeration objs)
          Release all the locks specified by objs.
 void releaseLocks(SessionIfc session)
          Release all the locks associated with this session.
 

Method Detail

acquireReadLock

void acquireReadLock(SessionIfc session,
                     PersistentObject obj)
                     throws FailedToAcquireLockException
Acquire a read lock on the specified PersistentObject. It will wait DefaultReadLockWaitTime ms, which is configurable. If the lock cannot be acquird wihin the specified time the function will throw FailedToAcquireLockException

Parameters:
obj - object to read-lock
Throws:
FailedToAcquireLockException

aquireWriteLock

boolean aquireWriteLock(SessionIfc session,
                        PersistentObject obj)
                        throws FailedToAcquireLockException
Acquire a write lock on the specified PersistentObject. It will wait DefaultWriteLockWaitTime ms which is configurable. If the lock has not been acquired, within the specified time, the function will throw

Parameters:
obj - object to write-lock
Throws:
FailedToAcqwuireLockException
FailedToAcquireLockException

acquireExclusiveLock

void acquireExclusiveLock(SessionIfc session,
                          PersistentObject obj)
                          throws FailedToAcquireLockException
Acquire an exclusive lock on the specified object. It will wait for DefaultExclusiveLockWaitTime ms, whihc is configurable.An exclusive lock cannot be shared with other users, as read andwrite locks. If the lock cannot be acquired within the specified time then throw the FailedToAcquireLockException

Parameters:
obj - object to exclusively-lock
Throws:
FailedToAcquireLockException

acquireReadLock

void acquireReadLock(SessionIfc session,
                     PersistentObject obj,
                     long wait)
                     throws FailedToAcquireLockException
Acquire a read lock on the specified PersistentObject. If the lock cannot be acquird wihin 'wait' ms the function will throw FailedToAcquireLockException

Parameters:
obj - object to read-lock
wait - time to wait in ms
Throws:
FailedToAcquireLockException

aquireWriteLock

boolean aquireWriteLock(SessionIfc session,
                        PersistentObject obj,
                        long wait)
                        throws FailedToAcquireLockException
Acquire a write lock on the specified PersistentObject. If the lock cannot be acquired, within 'wait' ms the function will throw FailedToAcquireLockException

Parameters:
obj - object to write-lock
wait - time to wait in ms
Throws:
FailedToAcquireLockException

acquireExclusiveLock

void acquireExclusiveLock(SessionIfc session,
                          PersistentObject obj,
                          long wait)
                          throws FailedToAcquireLockException
Acquire an exclusive lock on the specified object. An exclusive lock cannot be shared with other users, as read and write locks. If the lock cannot be acquired within 'wait' ms then throw the FailedToAcquireLockException

Parameters:
obj - object to exclusively-lock
wait - time to wait in ms
Throws:
FailedToAcquireLockException

acquireReadLocks

void acquireReadLocks(SessionIfc session,
                      java.util.Enumeration objs)
                      throws FailedToAcquireLocksException
Acquire read locks on all the specified PersistentObject(s). It will wait DefaultReadLockWaitTime ms, which is configurable. If allthe locks cannot be acquird wihin the specified time the function will throw FailedToAcquireLocksException. This exception defines the list of locks that it failed to acquire

Parameters:
obj - collection of PersistentObject instances
Throws:
FailedToAcquireLocksException

aquireWriteLocks

boolean aquireWriteLocks(SessionIfc session,
                         java.util.Enumeration objs)
                         throws FailedToAcquireLocksException
Acquire write locks on all the specified PersistentObject(s). It will wait DefaultWriteLockWaitTime ms which is configurable. If all the lock cannot be acquired, within the specified time, the function will throw FailedToAcquireLocksException

Parameters:
objs - collection of PersistentObject instances
Throws:
FailedToAcquireLocksException

acquireExclusiveLocks

void acquireExclusiveLocks(SessionIfc session,
                           java.util.Enumeration objs)
                           throws FailedToAcquireLocksException
Acquire exclusive locks on all the specified PersistentObject(s). It will wait for DefaultExclusiveLockWaitTime ms, which is configurable. An exclusive lock cannot be shared with other users, as read and write locks. If all the locks cannot be acquired within the specified time then throw the FailedToAcquireLocksException

Parameters:
objs - collection of PersistentObject instances
Throws:
FailedToAcquireLockException
FailedToAcquireLocksException

acquireReadLocks

void acquireReadLocks(SessionIfc session,
                      java.util.Enumeration objs,
                      long wait)
                      throws FailedToAcquireLocksException
Acquire read locks on the specified PersistentObject(s). If allthe lock cannot be acquird wihin 'wait' ms the function will throw FailedToAcquireLocksException

Parameters:
objs - collection of PersistentObject instances
wait - time to wait in ms
Throws:
FailedToAcquireLocksException

aquireWriteLocks

boolean aquireWriteLocks(SessionIfc session,
                         java.util.Enumeration objs,
                         long wait)
                         throws FailedToAcquireLocksException
Acquire write locks on the specified PersistentObject(s). If all the lock cannot be acquired, within 'wait' ms the function will throw FailedToAcquireLocskException

Parameters:
objs - collection of PersistentObject instances
wait - time to wait in ms
Throws:
FailedToAcquireLocksException

acquireExclusiveLocks

void acquireExclusiveLocks(SessionIfc session,
                           java.util.Enumeration objs,
                           long wait)
                           throws FailedToAcquireLocksException
Acquire exclusive locks on the specified objects. An exclusive lock cannot be shared with other users, as read and write locks. If all the lock cannot be acquired within 'wait' ms then throw the FailedToAcquireLocksException

Parameters:
objs - collection of PersistentObject instances
wait - time to wait in ms
Throws:
FailedToAcquireLocksException

releaseLock

void releaseLock(PersistentObject obj)
                 throws FailedToReleaseLockException
Release the lock on the specified object. If the objects is not locked than throw FailedToReleaseLockException

Parameters:
obj - object to release
Throws:
FailedToReleaseLockException

releaseLocks

void releaseLocks(java.util.Enumeration objs)
                  throws FailedToReleaseLocksException
Release all the locks specified by objs. If one or more of the locks are not available, or cannot be locked then throw the FailedToReleaseLocksException. This will contain a list of PersistentObj- ects that with no locks.

Parameters:
objs - objects to unlock
Throws:
FailedToReleaseLocksException

releaseLocks

void releaseLocks(SessionIfc session)
                  throws FailedToReleaseLocksException
Release all the locks associated with this session. If it encounters a problem releasing one or more locks then throw FailedToReleaseLocksException.

Throws:
FailedToReleaseLocksException

isLocked

boolean isLocked(PersistentObject obj)
Check whether the specified object is locked

Parameters:
obj - object to check
Returns:
boolean true if locked and false otherwise

getLockedObjects

java.util.Enumeration getLockedObjects(SessionIfc session)
Return the set of objectslocked for the specified session

Parameters:
session - session to query
Returns:
Enumeration

getAllLockedObjects

java.util.Enumeration getAllLockedObjects()
Return an enumeration of all locked object.

Returns:
Enumeration

releaseAllLocks

void releaseAllLocks()
Release all the locks maintained by the service. If it encounters a problem releasing one or more locks then throw FailedToReleaseLocksException.

Throws:
FailedToReleaseLocksException


Copyright © 1999-2012 The Exolab Group. All Rights Reserved.