org.sourceforge.jemm.database.components.se
Interface StorageEngineUserLockIF

All Known Implementing Classes:
BDbStorageEngineUserLockImpl, UserLockIFImpl

public interface StorageEngineUserLockIF

Storage interface for user lock management.

N.b. The caller is responsible for synchronising access to the user lock info and client lock information (normally using a lock manager).

Author:
Rory Graves

Method Summary
 void addClientLockReference(ClientThreadId clientId, ID objectId)
          Add a reference from a client to the given object.
 void clearAll()
          Clear all lock information.
 java.util.Set<ClientThreadIdRef> getClientLockSet(ClientId clientId)
          Return a set of client-threads -> ids for the given client, this is the list of objects the given client is attempting to lock, or has a lock on.
 UserLockInfo getLockInfo(ID id)
          Retrieve the user lock information (lock queue) for the given id.
 void removeClientLockReference(ClientThreadId clientId, ID objectId)
          Remove a reference from a client to the given object.
 void saveLockInfo(UserLockInfo info)
          Save an updated lock information.
 

Method Detail

getLockInfo

UserLockInfo getLockInfo(ID id)
Retrieve the user lock information (lock queue) for the given id.

Parameters:
id - The id of the lock object.
Returns:
The lock information for the given object.

saveLockInfo

void saveLockInfo(UserLockInfo info)
Save an updated lock information.

Parameters:
info - The update lock information to save.

clearAll

void clearAll()
Clear all lock information. This includes both UserLockInfo instances and client lock information. This is generally performed at startup to ensure any old locks from previous sessions have been removed.


addClientLockReference

void addClientLockReference(ClientThreadId clientId,
                            ID objectId)
Add a reference from a client to the given object.

Parameters:
clientId - The target client thread
objectId - The object being referenced.

removeClientLockReference

void removeClientLockReference(ClientThreadId clientId,
                               ID objectId)
Remove a reference from a client to the given object.

Parameters:
clientId - The target client.
objectId - The object being referenced.

getClientLockSet

java.util.Set<ClientThreadIdRef> getClientLockSet(ClientId clientId)
Return a set of client-threads -> ids for the given client, this is the list of objects the given client is attempting to lock, or has a lock on.

Parameters:
clientId - The target client id.
Returns:
The set of ids and client threads which are attempting to acquire them for the given client.


Copyright © 2009. All Rights Reserved.