org.sourceforge.jemm.database.components
Class DefaultDBUserLockHandler

java.lang.Object
  extended by org.sourceforge.jemm.database.components.DefaultDBUserLockHandler
All Implemented Interfaces:
DBUserLockHandler

public class DefaultDBUserLockHandler
extends java.lang.Object
implements DBUserLockHandler

Default lock handler for database implementations

Author:
Rory Graves

Constructor Summary
DefaultDBUserLockHandler(StorageEngine storageEngine, ObjectAccessor objectAccessor)
          Create a DefaultDBUserLockHandler instance
 
Method Summary
 void acquire(ClientThreadId threadId, ID objectId)
          Process the given thread attempting to acquire the lock in the given object.
 void clientDisconnect(ClientId clientId)
           
 void release(ClientThreadId threadId, ID objectId)
          Release the user lock on the given object
 void removeClientListener(ClientId clientId)
          Remove the lock acquire listener for the given client.
 void setClientListener(ClientId clientId, LockAcquiredListener listener)
          Sets the client callback listener for a given client.
 void shutdown()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultDBUserLockHandler

public DefaultDBUserLockHandler(StorageEngine storageEngine,
                                ObjectAccessor objectAccessor)
Create a DefaultDBUserLockHandler instance

Parameters:
storageEngine - The underlying storage engine.
objectAccessor - The object accessor to use.
Method Detail

removeClientListener

public void removeClientListener(ClientId clientId)
Description copied from interface: DBUserLockHandler
Remove the lock acquire listener for the given client.

Specified by:
removeClientListener in interface DBUserLockHandler
Parameters:
clientId - The client whose listener to remove.

release

public void release(ClientThreadId threadId,
                    ID objectId)
Description copied from interface: DBUserLockHandler
Release the user lock on the given object

Specified by:
release in interface DBUserLockHandler
Parameters:
threadId - The releasing thread
objectId - The id of the object

setClientListener

public void setClientListener(ClientId clientId,
                              LockAcquiredListener listener)
Description copied from interface: DBUserLockHandler
Sets the client callback listener for a given client.

Specified by:
setClientListener in interface DBUserLockHandler
Parameters:
clientId - The client to set the callback for.
listener - The listener to call on lock events pertaining to the given client.

acquire

public void acquire(ClientThreadId threadId,
                    ID objectId)
Description copied from interface: DBUserLockHandler
Process the given thread attempting to acquire the lock in the given object. This method will return immediately. Acquire notification is handled as an asynchronous callback.

Specified by:
acquire in interface DBUserLockHandler
Parameters:
threadId - The requesting thread.
objectId - The object to lock.

shutdown

public void shutdown()
Specified by:
shutdown in interface DBUserLockHandler

clientDisconnect

public void clientDisconnect(ClientId clientId)
Specified by:
clientDisconnect in interface DBUserLockHandler


Copyright © 2009. All Rights Reserved.