1 package org.sourceforge.jemm.database.components.interfaces; 2 3 import org.sourceforge.jemm.database.ClientId; 4 import org.sourceforge.jemm.database.ClientThreadId; 5 import org.sourceforge.jemm.database.LockAcquiredListener; 6 import org.sourceforge.jemm.types.ID; 7 8 /** 9 * Lock handling for the MemoryDatabase. 10 * 11 * @author Rory Graves 12 */ 13 public interface DBUserLockHandler { 14 /** 15 * Remove the lock acquire listener for the given client. 16 * @param clientId The client whose listener to remove. 17 */ 18 void removeClientListener(ClientId clientId); 19 20 /** 21 * Release the user lock on the given object 22 * @param threadId The releasing thread 23 * @param objectId The id of the object 24 */ 25 void release(ClientThreadId threadId, ID objectId); 26 27 /** 28 * Sets the client callback listener for a given client. 29 * @param clientId The client to set the callback for. 30 * @param listener The listener to call on lock events pertaining to the given client. 31 */ 32 void setClientListener(ClientId clientId, LockAcquiredListener listener); 33 34 /** 35 * Process the given thread attempting to acquire the lock in the given object. 36 * This method will return immediately. Acquire notification is handled as an 37 * asynchronous callback. 38 * @param threadId The requesting thread. 39 * @param objectId The object to lock. 40 */ 41 void acquire(ClientThreadId threadId, ID objectId); 42 43 void shutdown(); 44 45 void clientDisconnect(ClientId clientId); 46 }