Package nxt.db
Class TransactionalDb
java.lang.Object
nxt.db.BasicDb
nxt.db.TransactionalDb
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceTransaction callback interfaceNested classes/interfaces inherited from class nxt.db.BasicDb
BasicDb.DbProperties -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbeginTransaction(String schema) <V> VcallInDbTransaction(Callable<V> callable) voidvoidvoidgetConnection(String schema) booleanvoidvoidvoidrunInDbTransaction(Runnable runnable) voidsetThreadQueryTimeout(int seconds) Sets the timeout which will be used inStatement.executeQuery(String)andStatement.executeQuery(String)calls, done by this thread (for the current database).Methods inherited from class nxt.db.BasicDb
analyzeTables, getPooledConnection, getUrl, init, shutdown
-
Constructor Details
-
TransactionalDb
-
-
Method Details
-
callInDbTransaction
-
runInDbTransaction
-
getConnection
- Overrides:
getConnectionin classBasicDb- Throws:
SQLException
-
isInTransaction
public boolean isInTransaction() -
beginTransaction
-
beginTransaction
-
commitTransaction
public void commitTransaction() -
rollbackTransaction
public void rollbackTransaction() -
endTransaction
public void endTransaction() -
registerCallback
-
setThreadQueryTimeout
public void setThreadQueryTimeout(int seconds) Sets the timeout which will be used in
Statement.executeQuery(String)andStatement.executeQuery(String)calls, done by this thread (for the current database).Due to an issue in H2 implementation,
Statement.setQueryTimeout(int)affects all statements in the connection - see https://github.com/h2database/h2database/issues/243. So always reset to 0 after executing the queries that must be limited- Parameters:
seconds- the new query timeout limit in seconds for the current thread; zero means there is no limit
-
clearCache
public void clearCache()
-