org.apache.openjpa.kernel
Class NoneLockManager

java.lang.Object
  extended by org.apache.openjpa.kernel.AbstractLockManager
      extended by org.apache.openjpa.kernel.NoneLockManager
All Implemented Interfaces:
LockLevels, LockManager, Closeable

public class NoneLockManager
extends AbstractLockManager

A lock manager that does not perform any locking.

Author:
Marc Prud'hommeaux

Field Summary
 
Fields inherited from class org.apache.openjpa.kernel.AbstractLockManager
ctx, log
 
Fields inherited from interface org.apache.openjpa.kernel.LockLevels
LOCK_NONE, LOCK_READ, LOCK_WRITE
 
Constructor Summary
NoneLockManager()
           
 
Method Summary
 int getLockLevel(OpenJPAStateManager sm)
          Return the lock level of the specified instance, or LockLevels.LOCK_NONE if not locked.
 void lock(OpenJPAStateManager sm, int level, int timeout, Object context)
          Obtain a lock on the specified object.
 void refreshLock(OpenJPAStateManager sm, int level, int timeout, Object context)
          Perform the same function as previous lock method and has the option to perform a version check after the lock function has completed.
 void release(OpenJPAStateManager sm)
          Release the lock on the given object.
 
Methods inherited from class org.apache.openjpa.kernel.AbstractLockManager
beginTransaction, close, endTransaction, getContext, lockAll, setContext, skipRelationFieldLock
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NoneLockManager

public NoneLockManager()
Method Detail

lock

public void lock(OpenJPAStateManager sm,
                 int level,
                 int timeout,
                 Object context)
Description copied from interface: LockManager
Obtain a lock on the specified object. This method may be called when a user explicitly locks an object, and is also called automatically for every object accessed during a transaction. The implementation must track already-locked objects, and must be optimized to return quickly when the given object does not need additional locking. The lock manager might use the state manager's lock object for bookkeeping information.

Parameters:
sm - the object to lock
level - one of the lock constants defined in LockLevels, or a custom level
timeout - the timeout in milliseconds, or a negative number for no timeout
context - the context information passed from the store manager to the persistence context, if any; lock managers specific to a certain back end may be able to take advantage of this; others should ignore it
See Also:
OpenJPAStateManager.setLock(java.lang.Object)

refreshLock

public void refreshLock(OpenJPAStateManager sm,
                        int level,
                        int timeout,
                        Object context)
Description copied from interface: LockManager
Perform the same function as previous lock method and has the option to perform a version check after the lock function has completed.


release

public void release(OpenJPAStateManager sm)
Description copied from interface: LockManager
Release the lock on the given object. This method will be called automatically for each state manager with a lock object set on transaction completion, just before the call to LockManager.endTransaction(). The lock manager should null the state manager's lock object. Note that some state manager may be garbage collected during a transaction; thus lock managers cannot rely on this method being called for every state manager.

See Also:
OpenJPAStateManager.setLock(java.lang.Object)

getLockLevel

public int getLockLevel(OpenJPAStateManager sm)
Description copied from interface: LockManager
Return the lock level of the specified instance, or LockLevels.LOCK_NONE if not locked.



Copyright © 2006-2011 Apache Software Foundation. All Rights Reserved.