ehcache

net.sf.ehcache.transaction
Class TransactionIDFactoryImpl

java.lang.Object
  extended by net.sf.ehcache.transaction.AbstractTransactionIDFactory
      extended by net.sf.ehcache.transaction.TransactionIDFactoryImpl
All Implemented Interfaces:
TransactionIDFactory

public class TransactionIDFactoryImpl
extends AbstractTransactionIDFactory

A TransactionIDFactory implementation with uniqueness across a single JVM

Author:
Ludovic Orban

Constructor Summary
TransactionIDFactoryImpl()
           
 
Method Summary
 TransactionID createTransactionID()
          Create a unique transaction ID
 XidTransactionID createXidTransactionID(Xid xid, Ehcache cache)
          Create a transaction ID based on a XID for uniqueness
protected  ConcurrentMap<TransactionID,Decision> getTransactionStates()
          Return the map of transaction states.
 boolean isExpired(TransactionID transactionID)
          Check if the transaction ID expired, ie: that the transaction died abnormally
 Boolean isPersistent()
          Return true if the factory state is persistent (survives JVM restart).
 TransactionID restoreTransactionID(TransactionIDSerializedForm serializedForm)
          Restore a transaction ID from its serialized form
 XidTransactionID restoreXidTransactionID(XidTransactionIDSerializedForm serializedForm)
          Restore a XID transaction ID from its serialized form
 
Methods inherited from class net.sf.ehcache.transaction.AbstractTransactionIDFactory
clear, getAllTransactionIDs, getAllXidTransactionIDsFor, isDecisionCommit, markForCommit, markForRollback
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TransactionIDFactoryImpl

public TransactionIDFactoryImpl()
Method Detail

createTransactionID

public TransactionID createTransactionID()
Create a unique transaction ID

Returns:
a transaction ID

restoreTransactionID

public TransactionID restoreTransactionID(TransactionIDSerializedForm serializedForm)
Restore a transaction ID from its serialized form

Parameters:
serializedForm - the TransactionID serialized form
Returns:
the restored TransactionID

createXidTransactionID

public XidTransactionID createXidTransactionID(Xid xid,
                                               Ehcache cache)
Create a transaction ID based on a XID for uniqueness

Parameters:
xid - the XID
Returns:
a transaction ID

restoreXidTransactionID

public XidTransactionID restoreXidTransactionID(XidTransactionIDSerializedForm serializedForm)
Restore a XID transaction ID from its serialized form

Parameters:
serializedForm - the XidTransactionID serialized form
Returns:
the restored XidTransactionID

getTransactionStates

protected ConcurrentMap<TransactionID,Decision> getTransactionStates()
Description copied from class: AbstractTransactionIDFactory
Return the map of transaction states.

Specified by:
getTransactionStates in class AbstractTransactionIDFactory
Returns:
the map of transaction states

isPersistent

public Boolean isPersistent()
Description copied from interface: TransactionIDFactory
Return true if the factory state is persistent (survives JVM restart).

This is a tri-state return:

Returns:
true is state is persistent

isExpired

public boolean isExpired(TransactionID transactionID)
Description copied from interface: TransactionIDFactory
Check if the transaction ID expired, ie: that the transaction died abnormally

Returns:
true if the transaction ID expired and should be cleaned up, false otherwise

ehcache

Copyright 2001-2015, Terracotta, Inc.