org.terracotta.locking.strategy
Class OneToOneLockStrategy

java.lang.Object
  extended by org.terracotta.locking.strategy.BasicLockStrategy<String>
      extended by org.terracotta.locking.strategy.OneToOneLockStrategy
All Implemented Interfaces:
GenericLockStrategy<String,String>, LockStrategy<String>

public class OneToOneLockStrategy
extends BasicLockStrategy<String>

A String key only lock strategy where locking is performed on a concatentation of the the instance qualifier and the string key itself.


Constructor Summary
OneToOneLockStrategy()
           
 
Method Summary
 String generateLockIdForKey(String instanceQualifier, String key)
          Generate the lock identifier to be used when performing operations for the given key.
 
Methods inherited from class org.terracotta.locking.strategy.BasicLockStrategy
beginLock, commitLock, pinLock, tryBeginLock, unpinLock
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OneToOneLockStrategy

public OneToOneLockStrategy()
Method Detail

generateLockIdForKey

public String generateLockIdForKey(String instanceQualifier,
                                   String key)
Description copied from interface: LockStrategy
Generate the lock identifier to be used when performing operations for the given key.

To prevent inter-map lock collisions the instanceQualifier provided by the caller should be used to form the key.

Parameters:
instanceQualifier - A unique identifier for the map being operated on.
key - key to be locked
Returns:
lock identifier


Copyright © 2015 Terracotta, Inc.. All Rights Reserved.