Package marauroa.server.db
Class TransactionPool
java.lang.Object
marauroa.server.db.TransactionPool
Connection Pool.
- Author:
- hendrik
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstarts a transaction and marks it as reservedvoid
close()
closes the transaction poolvoid
commit(DBTransaction dbtransaction)
commits this transaction and frees its reservationvoid
dumps a list of open transactions with their threads and stacktraces to the log file.static TransactionPool
get()
gets the TransactionPoolvoid
Kicks all transactions which were started in the current threadvoid
killTransaction(DBTransaction dbtransaction)
kills a transaction by rolling it back and closing it; it will be removed from the poolvoid
removes transactions from the pool that are not connected to the databaes anymorevoid
registers this TransactionPool as the global one.void
rollback(DBTransaction dbtransaction)
rolls this transaction back and frees the reservationvoid
verifies 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
-