Package marauroa.server.db
Class TransactionPool
java.lang.Object
marauroa.server.db.TransactionPool
Connection Pool.
- Author:
- hendrik
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstarts a transaction and marks it as reservedvoidclose()closes the transaction poolvoidcommit(DBTransaction dbtransaction)commits this transaction and frees its reservationvoiddumps a list of open transactions with their threads and stacktraces to the log file.static TransactionPoolget()gets the TransactionPoolvoidKicks all transactions which were started in the current threadvoidkillTransaction(DBTransaction dbtransaction)kills a transaction by rolling it back and closing it; it will be removed from the poolvoidremoves transactions from the pool that are not connected to the databaes anymorevoidregisters this TransactionPool as the global one.voidrollback(DBTransaction dbtransaction)rolls this transaction back and frees the reservationvoidverifies all available transactions
-
Constructor Details
-
TransactionPool
creates a DBTransactionPool- Parameters:
connfiguration- configuration
-
-
Method Details
-
registerGlobally
public void registerGlobally()registers this TransactionPool as the global one. -
get
gets the TransactionPool- Returns:
- TransactionPool
-
beginWork
starts a transaction and marks it as reserved- Returns:
- DBTransaction
-
dumpOpenTransactions
public void dumpOpenTransactions()dumps a list of open transactions with their threads and stacktraces to the log file. -
commit
commits this transaction and frees its reservation- Parameters:
dbtransaction- transaction- Throws:
SQLException- in case of an database error
-
rollback
rolls this transaction back and frees the reservation- Parameters:
dbtransaction- transaction
-
kickHangingTransactionsOfThisThread
public void kickHangingTransactionsOfThisThread()Kicks all transactions which were started in the current thread -
refreshAvailableTransaction
public void refreshAvailableTransaction()removes transactions from the pool that are not connected to the databaes anymore -
killTransaction
kills a transaction by rolling it back and closing it; it will be removed from the pool- Parameters:
dbtransaction- DBTransaction
-
verifyAllAvailableConnections
public void verifyAllAvailableConnections()verifies all available transactions -
close
public void close()closes the transaction pool
-