ehcache

net.sf.ehcache.transaction
Interface TransactionIDFactory

All Known Implementing Classes:
AbstractTransactionIDFactory, DelegatingTransactionIDFactory, TransactionIDFactoryImpl

public interface TransactionIDFactory

A factory for transaction IDs. Generated transaction ID's must be unique to the entire cluster-wide CacheManager.

Author:
Ludovic Orban

Method Summary
 void clear(TransactionID transactionID)
          Clear this transaction's state representation.
 TransactionID createTransactionID()
          Create a unique transaction ID
 XidTransactionID createXidTransactionID(Xid xid, Ehcache cache)
          Create a transaction ID based on a XID for uniqueness
 Set<TransactionID> getAllTransactionIDs()
          Get the set of all known transactions.
 Set<XidTransactionID> getAllXidTransactionIDsFor(Ehcache cache)
          Get the set of all XID transactions of a cache.
 boolean isDecisionCommit(TransactionID transactionID)
          Check if the given transaction should be committed or not
 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).
 void markForCommit(TransactionID transactionID)
          Mark that this transaction's decision is commit
 void markForRollback(XidTransactionID transactionID)
          Mark this transaction ID for rollback
 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
 

Method Detail

createTransactionID

TransactionID createTransactionID()
Create a unique transaction ID

Returns:
a transaction ID

restoreTransactionID

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

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

createXidTransactionID

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

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

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

markForCommit

void markForCommit(TransactionID transactionID)
Mark that this transaction's decision is commit

Parameters:
transactionID - transaction to be marked

markForRollback

void markForRollback(XidTransactionID transactionID)
Mark this transaction ID for rollback


isDecisionCommit

boolean isDecisionCommit(TransactionID transactionID)
Check if the given transaction should be committed or not

Parameters:
transactionID - transaction to be queried
Returns:
true if the transaction should be committed

clear

void clear(TransactionID transactionID)
Clear this transaction's state representation.

Parameters:
transactionID - transaction to be cleared

getAllXidTransactionIDsFor

Set<XidTransactionID> getAllXidTransactionIDsFor(Ehcache cache)
Get the set of all XID transactions of a cache.

Returns:
the set of transactions

getAllTransactionIDs

Set<TransactionID> getAllTransactionIDs()
Get the set of all known transactions.

Returns:
the set of transactions

isPersistent

Boolean isPersistent()
Return true if the factory state is persistent (survives JVM restart).

This is a tri-state return:

Returns:
true is state is persistent

isExpired

boolean isExpired(TransactionID transactionID)
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.