org.terracotta.locking.strategy
Class HashcodeLockStrategy

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

public class HashcodeLockStrategy
extends BasicLockStrategy<Object>

A simple lock strategy where locks are taken on a concatentation of the instance qualifier and the key's hashcode.


Constructor Summary
HashcodeLockStrategy()
           
 
Method Summary
 String generateLockIdForKey(String instanceQualifier, Object 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

HashcodeLockStrategy

public HashcodeLockStrategy()
Method Detail

generateLockIdForKey

public String generateLockIdForKey(String instanceQualifier,
                                   Object 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.