Top Description Fields Constructors Methods
net.sf.ehcache.transaction

public Class DelegatingTransactionIDFactory

extends Object
implements TransactionIDFactory
Class Inheritance
All Implemented Interfaces
net.sf.ehcache.transaction.TransactionIDFactory
Imports
net.sf.ehcache.Ehcache, .FeaturesManager, net.sf.ehcache.terracotta.ClusteredInstanceFactory, .TerracottaClient, net.sf.ehcache.transaction.xa.XidTransactionID, java.util.Set, .UUID, java.util.concurrent.atomic.AtomicReference, javax.transaction.xa.Xid

A TransactionIDFactory implementation with delegates calls to either a clustered or non-clustered factory
Author
Ludovic Orban

Field Summary

Modifier and TypeField and Description
private final String
private volatile ClusteredInstanceFactory
private final FeaturesManager
private final TerracottaClient
private volatile AtomicReference<TransactionIDFactory>

Constructor Summary

AccessConstructor and Description
public
DelegatingTransactionIDFactory(FeaturesManager featuresManager, TerracottaClient
a terracotta client
terracottaClient
,
String
the name of the cache manager which creates this.
cacheManagerName
)

Create a new DelegatingTransactionIDFactory

Method Summary

Modifier and TypeMethod and Description
public void
clear(TransactionID
transaction to be cleared
transactionID
)

Implements net.sf.ehcache.transaction.TransactionIDFactory.clear.

Clear this transaction's state representation.
public TransactionID
public XidTransactionID
createXidTransactionID(Xid
the XID
xid
,
Ehcache cache)

Implements net.sf.ehcache.transaction.TransactionIDFactory.createXidTransactionID.

Create a transaction ID based on a XID for uniqueness
private TransactionIDFactory
get()

public Set<TransactionID>
public Set<XidTransactionID>
public boolean
isDecisionCommit(TransactionID
transaction to be queried
transactionID
)

Implements net.sf.ehcache.transaction.TransactionIDFactory.isDecisionCommit.

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

Implements net.sf.ehcache.transaction.TransactionIDFactory.isExpired.

Check if the transaction ID expired, ie: that the transaction died abnormally
public Boolean
isPersistent()

Implements net.sf.ehcache.transaction.TransactionIDFactory.isPersistent.

Return true if the factory state is persistent (survives JVM restart).
public void
markForCommit(TransactionID
transaction to be marked
transactionID
)

Implements net.sf.ehcache.transaction.TransactionIDFactory.markForCommit.

Mark that this transaction's decision is commit
public void
markForRollback(XidTransactionID transactionID)

Implements net.sf.ehcache.transaction.TransactionIDFactory.markForRollback.

Mark this transaction ID for rollback
public TransactionID
restoreTransactionID(TransactionIDSerializedForm
the TransactionID serialized form
serializedForm
)

Implements net.sf.ehcache.transaction.TransactionIDFactory.restoreTransactionID.

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

Implements net.sf.ehcache.transaction.TransactionIDFactory.restoreXidTransactionID.

Restore a XID transaction ID from its serialized form
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

cacheManagerNameback to summary
private final String cacheManagerName
clusteredInstanceFactoryback to summary
private volatile ClusteredInstanceFactory clusteredInstanceFactory
featuresManagerback to summary
private final FeaturesManager featuresManager
terracottaClientback to summary
private final TerracottaClient terracottaClient
transactionIDFactoryback to summary
private volatile AtomicReference<TransactionIDFactory> transactionIDFactory

Constructor Detail

DelegatingTransactionIDFactoryback to summary
public DelegatingTransactionIDFactory(FeaturesManager featuresManager, TerracottaClient terracottaClient, String cacheManagerName)

Create a new DelegatingTransactionIDFactory

Parameters
terracottaClient:TerracottaClient

a terracotta client

cacheManagerName:String

the name of the cache manager which creates this.

Method Detail

clearback to summary
public void clear(TransactionID transactionID)

Implements net.sf.ehcache.transaction.TransactionIDFactory.clear.

Doc from net.sf.ehcache.transaction.TransactionIDFactory.clear.

Clear this transaction's state representation.

Parameters
transactionID:TransactionID

transaction to be cleared

Annotations
@Override
createTransactionIDback to summary
public TransactionID createTransactionID()

Implements net.sf.ehcache.transaction.TransactionIDFactory.createTransactionID.

Doc from net.sf.ehcache.transaction.TransactionIDFactory.createTransactionID.

Create a unique transaction ID

Returns:TransactionID

a transaction ID

createXidTransactionIDback to summary
public XidTransactionID createXidTransactionID(Xid xid, Ehcache cache)

Implements net.sf.ehcache.transaction.TransactionIDFactory.createXidTransactionID.

Doc from net.sf.ehcache.transaction.TransactionIDFactory.createXidTransactionID.

Create a transaction ID based on a XID for uniqueness

Parameters
xid:Xid

the XID

Returns:XidTransactionID

a transaction ID

getback to summary
private TransactionIDFactory get()
getAllTransactionIDsback to summary
public Set<TransactionID> getAllTransactionIDs()

Implements net.sf.ehcache.transaction.TransactionIDFactory.getAllTransactionIDs.

Doc from net.sf.ehcache.transaction.TransactionIDFactory.getAllTransactionIDs.

Get the set of all known transactions.

Returns:Set<TransactionID>

the set of transactions

Annotations
@Override
getAllXidTransactionIDsForback to summary
public Set<XidTransactionID> getAllXidTransactionIDsFor(Ehcache cache)

Implements net.sf.ehcache.transaction.TransactionIDFactory.getAllXidTransactionIDsFor.

Doc from net.sf.ehcache.transaction.TransactionIDFactory.getAllXidTransactionIDsFor.

Get the set of all XID transactions of a cache.

Returns:Set<XidTransactionID>

the set of transactions

Annotations
@Override
isDecisionCommitback to summary
public boolean isDecisionCommit(TransactionID transactionID)

Implements net.sf.ehcache.transaction.TransactionIDFactory.isDecisionCommit.

Doc from net.sf.ehcache.transaction.TransactionIDFactory.isDecisionCommit.

Check if the given transaction should be committed or not

Parameters
transactionID:TransactionID

transaction to be queried

Returns:boolean

true if the transaction should be committed

Annotations
@Override
isExpiredback to summary
public boolean isExpired(TransactionID transactionID)

Implements net.sf.ehcache.transaction.TransactionIDFactory.isExpired.

Doc from net.sf.ehcache.transaction.TransactionIDFactory.isExpired.

Check if the transaction ID expired, ie: that the transaction died abnormally

Returns:boolean

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

Annotations
@Override
isPersistentback to summary
public Boolean isPersistent()

Implements net.sf.ehcache.transaction.TransactionIDFactory.isPersistent.

Doc from net.sf.ehcache.transaction.TransactionIDFactory.isPersistent.

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

This is a tri-state return:

  • Boolean.TRUE : persistent
  • Boolean.FALSE : not persistent
  • null : not yet determined
Returns:Boolean

true is state is persistent

Annotations
@Override
markForCommitback to summary
public void markForCommit(TransactionID transactionID)

Implements net.sf.ehcache.transaction.TransactionIDFactory.markForCommit.

Doc from net.sf.ehcache.transaction.TransactionIDFactory.markForCommit.

Mark that this transaction's decision is commit

Parameters
transactionID:TransactionID

transaction to be marked

Annotations
@Override
markForRollbackback to summary
public void markForRollback(XidTransactionID transactionID)

Implements net.sf.ehcache.transaction.TransactionIDFactory.markForRollback.

Doc from net.sf.ehcache.transaction.TransactionIDFactory.markForRollback.

Mark this transaction ID for rollback

Annotations
@Override
restoreTransactionIDback to summary
public TransactionID restoreTransactionID(TransactionIDSerializedForm serializedForm)

Implements net.sf.ehcache.transaction.TransactionIDFactory.restoreTransactionID.

Doc from net.sf.ehcache.transaction.TransactionIDFactory.restoreTransactionID.

Restore a transaction ID from its serialized form

Parameters
serializedForm:TransactionIDSerializedForm

the TransactionID serialized form

Returns:TransactionID

the restored TransactionID

restoreXidTransactionIDback to summary
public XidTransactionID restoreXidTransactionID(XidTransactionIDSerializedForm serializedForm)

Implements net.sf.ehcache.transaction.TransactionIDFactory.restoreXidTransactionID.

Doc from net.sf.ehcache.transaction.TransactionIDFactory.restoreXidTransactionID.

Restore a XID transaction ID from its serialized form

Parameters
serializedForm:XidTransactionIDSerializedForm

the XidTransactionID serialized form

Returns:XidTransactionID

the restored XidTransactionID