Package org.infinispan.stats
Class TransactionStatistics
- java.lang.Object
-
- org.infinispan.stats.TransactionStatistics
-
- Direct Known Subclasses:
LocalTransactionStatistics
,RemoteTransactionStatistics
public abstract class TransactionStatistics extends Object
Keeps the temporary statistics for a transaction. Also, it has the common logic for the local and remote transactions- Since:
- 6.0
- Author:
- Roberto Palmieri, Sebastiano Peluso, Diego Didona, Pedro Ruivo
-
-
Field Summary
Fields Modifier and Type Field Description protected long
initTime
protected static org.infinispan.stats.logging.Log
log
protected TimeService
timeService
protected boolean
trace
-
Constructor Summary
Constructors Modifier Constructor Description protected
TransactionStatistics(ExtendedStatisticsContainer container, TimeService timeService)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
addValue(ExtendedStatistic stat, double value)
Adds a value to a statistic collected for this transaction.protected void
copyValue(ExtendedStatistic from, ExtendedStatistic to)
Copies a statistic value and adds it to another statistic.void
flushTo(ConcurrentGlobalContainer globalContainer)
Merges this statistics in the global container.double
getValue(ExtendedStatistic stat)
void
incrementValue(ExtendedStatistic stat)
Increments a statistic value.boolean
isCommitted()
abstract boolean
isLocalTransaction()
boolean
isReadOnly()
void
markAsUpdateTransaction()
Sets this transaction as a write transaction.abstract void
onPrepareCommand()
Signals the reception of thePrepareCommand
.void
setOutcome(boolean commit)
Sets the transaction outcome.protected abstract void
terminate()
Signals this transaction as completed and updates the statistics to the final values ready to be merged in the cache statistics.void
terminateTransaction()
Signals this transaction as completed and updates the statistics to the final values ready to be merged in the cache statistics.String
toString()
-
-
-
Field Detail
-
initTime
protected final long initTime
-
log
protected static final org.infinispan.stats.logging.Log log
-
trace
protected final boolean trace
-
timeService
protected final TimeService timeService
-
-
Constructor Detail
-
TransactionStatistics
protected TransactionStatistics(ExtendedStatisticsContainer container, TimeService timeService)
-
-
Method Detail
-
isCommitted
public final boolean isCommitted()
- Returns:
true
if the transaction committed successfully,false
otherwise
-
setOutcome
public final void setOutcome(boolean commit)
Sets the transaction outcome. SeeisCommitted()
.- Parameters:
commit
-true
if the transaction is committed successfully.
-
isReadOnly
public final boolean isReadOnly()
- Returns:
true
if this transaction is a read-only transaction.
-
markAsUpdateTransaction
public final void markAsUpdateTransaction()
Sets this transaction as a write transaction. See alsoisReadOnly()
.
-
addValue
public final void addValue(ExtendedStatistic stat, double value)
Adds a value to a statistic collected for this transaction.
-
getValue
public final double getValue(ExtendedStatistic stat) throws ExtendedStatisticNotFoundException
- Returns:
- a value collected for this transaction.
- Throws:
ExtendedStatisticNotFoundException
- if the statistic collected was not found.
-
incrementValue
public final void incrementValue(ExtendedStatistic stat)
Increments a statistic value. It is equivalent toaddValue(stat, 1)
.
-
terminateTransaction
public final void terminateTransaction()
Signals this transaction as completed and updates the statistics to the final values ready to be merged in the cache statistics.
-
flushTo
public final void flushTo(ConcurrentGlobalContainer globalContainer)
Merges this statistics in the global container.
-
onPrepareCommand
public abstract void onPrepareCommand()
Signals the reception of thePrepareCommand
.
-
isLocalTransaction
public abstract boolean isLocalTransaction()
- Returns:
true
if this transaction statistics is for a local transaction.
-
terminate
protected abstract void terminate()
Signals this transaction as completed and updates the statistics to the final values ready to be merged in the cache statistics. This method is abstract in order to be override for the local and the remote transactions.
-
copyValue
protected final void copyValue(ExtendedStatistic from, ExtendedStatistic to)
Copies a statistic value and adds it to another statistic.
-
-