ehcache

net.sf.ehcache.transaction.xa.commands
Class AbstractStoreCommand

java.lang.Object
  extended by net.sf.ehcache.transaction.xa.commands.AbstractStoreCommand
All Implemented Interfaces:
Command
Direct Known Subclasses:
StorePutCommand, StoreRemoveCommand

public abstract class AbstractStoreCommand
extends Object
implements Command

Author:
Ludovic Orban

Constructor Summary
AbstractStoreCommand(Element oldElement, Element newElement)
          Create a Store Command
 
Method Summary
protected  Element getNewElement()
          Get the new element to put in the underlying store
protected  Element getOldElement()
          Get the element in the underlying store at the time this command is created
 boolean prepare(Store store, SoftLockManager softLockManager, XidTransactionID transactionId, ElementValueComparator comparator)
          Prepare the commmand un the underlying store
 void rollback(Store store, SoftLockManager softLockManager)
          Rollback the prepared change
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.sf.ehcache.transaction.xa.commands.Command
getObjectKey, isPut, isRemove
 

Constructor Detail

AbstractStoreCommand

public AbstractStoreCommand(Element oldElement,
                            Element newElement)
Create a Store Command

Parameters:
oldElement - the element in the underlying store at the time this command is created
newElement - the new element to put in the underlying store
Method Detail

getOldElement

protected Element getOldElement()
Get the element in the underlying store at the time this command is created

Returns:
the old element

getNewElement

protected Element getNewElement()
Get the new element to put in the underlying store

Returns:
the new element to put in the underlying store

prepare

public boolean prepare(Store store,
                       SoftLockManager softLockManager,
                       XidTransactionID transactionId,
                       ElementValueComparator comparator)
Prepare the commmand un the underlying store

Specified by:
prepare in interface Command
Parameters:
store - the underdyling store
softLockManager - the soft lock manager
transactionId - the transaction ID
comparator - the element value comparator
Returns:
true if prepare updated the store, false otherwise

rollback

public void rollback(Store store,
                     SoftLockManager softLockManager)
Rollback the prepared change

Specified by:
rollback in interface Command
Parameters:
store - the underlying store
softLockManager - the soft lock manager

ehcache

Copyright 2001-2015, Terracotta, Inc.