org.datanucleus.state.lock
Class LockManagerImpl

java.lang.Object
  extended by org.datanucleus.state.lock.LockManagerImpl
All Implemented Interfaces:
LockManager

public class LockManagerImpl
extends java.lang.Object
implements LockManager

Implementation of a lock manager for objects.


Field Summary
 
Fields inherited from interface org.datanucleus.state.lock.LockManager
LOCK_MODE_NONE, LOCK_MODE_OPTIMISTIC_READ, LOCK_MODE_OPTIMISTIC_WRITE, LOCK_MODE_PESSIMISTIC_READ, LOCK_MODE_PESSIMISTIC_WRITE
 
Constructor Summary
LockManagerImpl()
           
 
Method Summary
 void clear()
          Method to clear all settings of required lock level for object ids (mode 2).
 void close()
          Method to close the manager and release resources.
 short getLockMode(java.lang.Object id)
          Accessor for what locking should be applied to the object with the specified identity (mode 2).
 short getLockMode(StateManager sm)
          Accessor for the current lock mode for the object managed by the passed StateManager (mode 1).
 void lock(java.lang.Object id, short lockMode)
          Method to lock the object with the provided identity (mode 2).
 void lock(StateManager sm, short lockMode)
          Method to lock the object managed by the passed StateManager (mode 1).
 void unlock(StateManager sm)
          Method to unlock the object managed by the passed StateManager (mode 1).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LockManagerImpl

public LockManagerImpl()
Method Detail

close

public void close()
Description copied from interface: LockManager
Method to close the manager and release resources.

Specified by:
close in interface LockManager

lock

public void lock(java.lang.Object id,
                 short lockMode)
Description copied from interface: LockManager
Method to lock the object with the provided identity (mode 2).

Specified by:
lock in interface LockManager
Parameters:
id - Identity of the object
lockMode - mode for locking

getLockMode

public short getLockMode(java.lang.Object id)
Description copied from interface: LockManager
Accessor for what locking should be applied to the object with the specified identity (mode 2).

Specified by:
getLockMode in interface LockManager
Parameters:
id - The identity
Returns:
The lock mode to apply (NONE if nothing defined)

clear

public void clear()
Description copied from interface: LockManager
Method to clear all settings of required lock level for object ids (mode 2).

Specified by:
clear in interface LockManager

lock

public void lock(StateManager sm,
                 short lockMode)
Description copied from interface: LockManager
Method to lock the object managed by the passed StateManager (mode 1).

Specified by:
lock in interface LockManager
Parameters:
sm - StateManager for the object
lockMode - mode for locking

unlock

public void unlock(StateManager sm)
Description copied from interface: LockManager
Method to unlock the object managed by the passed StateManager (mode 1).

Specified by:
unlock in interface LockManager
Parameters:
sm - StateManager for the object

getLockMode

public short getLockMode(StateManager sm)
Description copied from interface: LockManager
Accessor for the current lock mode for the object managed by the passed StateManager (mode 1).

Specified by:
getLockMode in interface LockManager
Parameters:
sm - StateManager for the object
Returns:
The lock mode


Copyright © 2011. All Rights Reserved.