java.lang.Object
org.tentackle.dbms.DbTransactionFactory
Factory for transactions.
Collects duration statistics and monitors transactions.
Collects duration statistics and monitors transactions.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidconfigure(EncryptedProperties properties) Configures the factory from the main session properties.Creates a transaction.
Notice that this method is only invoked for local sessions, never for remote sessions.voidfinish(DbTransaction transaction, boolean rolledBack) Finishes a transaction.
Invoked when a transaction is committed or rolled back.
Notice that this method is only invoked for local sessions, never for remote sessions.static DbTransactionFactoryThe singleton.longGets the check interval for idle or unreferenced transactions in ms.intGets the number of check intervals that must elapse to for an idle transaction to time out.booleanReturns whether statistics are collected.voidlogStatistics(Logger.Level level, boolean clear) Logs the statistics.voidRequests supervisor thread termination.voidsetCollectingStatistics(boolean collectingStatistics) Sets whether statistics should be collected.voidsetTxIdleInterval(long txIdleInterval) Sets the check interval for idle or unreferenced transactions in ms.voidsetTxIdleTimeout(int txIdleTimeout) Sets the number of check intervals that must elapse to for an idle transaction to time out.
-
Constructor Details
-
DbTransactionFactory
public DbTransactionFactory()Creates the transaction factory.
-
-
Method Details
-
getInstance
The singleton.- Returns:
- the singleton
-
configure
Configures the factory from the main session properties.- Parameters:
properties- the properties
-
create
Creates a transaction.
Notice that this method is only invoked for local sessions, never for remote sessions.- Parameters:
db- the sessiontxName- the transaction name, null if <unnamed>fromRemote- true if initiated from remote client
-
finish
Finishes a transaction.
Invoked when a transaction is committed or rolled back.
Notice that this method is only invoked for local sessions, never for remote sessions.- Parameters:
transaction- the transactionrolledBack- true if transaction was rolled back, false if committed
-
setCollectingStatistics
public void setCollectingStatistics(boolean collectingStatistics) Sets whether statistics should be collected.- Parameters:
collectingStatistics- true if transactions are counted and execution times measured
-
isCollectingStatistics
public boolean isCollectingStatistics()Returns whether statistics are collected.- Returns:
- true if transactions are counted and execution times measured
-
logStatistics
Logs the statistics.- Parameters:
level- the logging levelclear- true if clear statistics after dump
-
getTxIdleInterval
public long getTxIdleInterval()Gets the check interval for idle or unreferenced transactions in ms.- Returns:
- the check interval
-
setTxIdleInterval
public void setTxIdleInterval(long txIdleInterval) Sets the check interval for idle or unreferenced transactions in ms.- Parameters:
txIdleInterval- the check interval
-
getTxIdleTimeout
public int getTxIdleTimeout()Gets the number of check intervals that must elapse to for an idle transaction to time out.- Returns:
- the idle count
-
setTxIdleTimeout
public void setTxIdleTimeout(int txIdleTimeout) Sets the number of check intervals that must elapse to for an idle transaction to time out.- Parameters:
txIdleTimeout- the idle count, ≤ 0 to disable
-
requestTermination
public void requestTermination()Requests supervisor thread termination.
-