ehcache

net.sf.ehcache.transaction
Class SoftLockID

java.lang.Object
  extended by net.sf.ehcache.transaction.SoftLockID
All Implemented Interfaces:
Serializable

public final class SoftLockID
extends Object
implements Serializable

A soft lock ID is used to uniquely identify a soft lock

Author:
Ludovic Orban
See Also:
Serialized Form

Constructor Summary
SoftLockID(TransactionID transactionID, Object key, Element newElement, Element oldElement, boolean wasPinned)
          Create a new SoftLockID instance
 
Method Summary
 boolean equals(Object object)
          
 Object getKey()
          Get the key of the element this soft lock is guarding
 Element getNewElement()
          Get the Element with which this soft lock should be replaced by on commit.
 Element getOldElement()
          Get the Element with which this soft lock should be replaced by on rollback.
 TransactionID getTransactionID()
          Get the ID of the transaction under which this soft lock is operating
 int hashCode()
          
 String toString()
          
 boolean wasPinned()
          Check if the key was pinned in the underlying store before its element was replaced by this soft lock
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SoftLockID

public SoftLockID(TransactionID transactionID,
                  Object key,
                  Element newElement,
                  Element oldElement,
                  boolean wasPinned)
Create a new SoftLockID instance

Parameters:
transactionID - the transaction ID
key - the element's key this soft lock is going to protect
newElement - the new element, can be null
oldElement - the old element, can be null
wasPinned - true if the key whose element is about to be replaced by this soft lock was pinned in the underlying store
Method Detail

wasPinned

public boolean wasPinned()
Check if the key was pinned in the underlying store before its element was replaced by this soft lock

Returns:
true if the key was pinned, false otherwise

getTransactionID

public TransactionID getTransactionID()
Get the ID of the transaction under which this soft lock is operating

Returns:
the TransactionID

getKey

public Object getKey()
Get the key of the element this soft lock is guarding

Returns:
the key

getNewElement

public Element getNewElement()
Get the Element with which this soft lock should be replaced by on commit.

Returns:
the commit Element

getOldElement

public Element getOldElement()
Get the Element with which this soft lock should be replaced by on rollback.

Returns:
the rollback Element

hashCode

public int hashCode()

Overrides:
hashCode in class Object

equals

public boolean equals(Object object)

Overrides:
equals in class Object

toString

public String toString()

Overrides:
toString in class Object

ehcache

Copyright © 2003-2014 Terracotta, Inc.. All Rights Reserved.