Package org.infinispan.extendedstats
Class TransactionStatistics
java.lang.Object
org.infinispan.extendedstats.TransactionStatistics
- Direct Known Subclasses:
LocalTransactionStatistics,RemoteTransactionStatistics
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
FieldsModifier and TypeFieldDescriptionprotected final longprotected static final Logprotected final TimeService -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedTransactionStatistics(ExtendedStatisticsContainer container, TimeService timeService) -
Method Summary
Modifier and TypeMethodDescriptionfinal voidaddValue(ExtendedStatistic stat, double value) Adds a value to a statistic collected for this transaction.protected final voidcopyValue(ExtendedStatistic from, ExtendedStatistic to) Copies a statistic value and adds it to another statistic.final voidflushTo(ConcurrentGlobalContainer globalContainer) Merges this statistics in the global container.final doublegetValue(ExtendedStatistic stat) final voidIncrements a statistic value.final booleanabstract booleanfinal booleanfinal voidSets this transaction as a write transaction.abstract voidSignals the reception of thePrepareCommand.final voidsetOutcome(boolean commit) Sets the transaction outcome.protected abstract voidSignals this transaction as completed and updates the statistics to the final values ready to be merged in the cache statistics.final voidSignals this transaction as completed and updates the statistics to the final values ready to be merged in the cache statistics.toString()
-
Field Details
-
initTime
protected final long initTime -
log
-
timeService
-
-
Constructor Details
-
TransactionStatistics
-
-
Method Details
-
isCommitted
public final boolean isCommitted()- Returns:
trueif the transaction committed successfully,falseotherwise
-
setOutcome
public final void setOutcome(boolean commit) Sets the transaction outcome. SeeisCommitted().- Parameters:
commit-trueif the transaction is committed successfully.
-
isReadOnly
public final boolean isReadOnly()- Returns:
trueif this transaction is a read-only transaction.
-
markAsUpdateTransaction
public final void markAsUpdateTransaction()Sets this transaction as a write transaction. See alsoisReadOnly(). -
addValue
Adds a value to a statistic collected for this transaction. -
getValue
- Returns:
- a value collected for this transaction.
- Throws:
ExtendedStatisticNotFoundException- if the statistic collected was not found.
-
incrementValue
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
Merges this statistics in the global container. -
toString
-
onPrepareCommand
public abstract void onPrepareCommand()Signals the reception of thePrepareCommand. -
isLocalTransaction
public abstract boolean isLocalTransaction()- Returns:
trueif 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
Copies a statistic value and adds it to another statistic.
-