mirror of
https://github.com/librecaptcha/lc-core.git
synced 2025-01-13 15:03:20 -05:00
minor: added comment about per thread connections
This commit is contained in:
parent
79428bc5e7
commit
f8de5a5932
@ -110,6 +110,13 @@ class Statements(dbConn: DBConn, maxAttempts: Int) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
object Statements {
|
object Statements {
|
||||||
|
/* Note: h2 documentation recommends using a separate DB connection per thread
|
||||||
|
But in practice, as of version 1.4.200, multiple connections occassionally shows error on the console of the form
|
||||||
|
```
|
||||||
|
org.h2.jdbc.JdbcSQLNonTransientException: General error: "java.lang.NullPointerException"; SQL statement:
|
||||||
|
SELECT image FROM challenge c, mapId m WHERE c.token=m.token AND m.uuid = ? [50000-200]
|
||||||
|
```
|
||||||
|
*/
|
||||||
private val dbConn: DBConn = new DBConn()
|
private val dbConn: DBConn = new DBConn()
|
||||||
private val maxAttempts = 10
|
private val maxAttempts = 10
|
||||||
val tlStmts: ThreadLocal[Statements] = ThreadLocal.withInitial(() => new Statements(dbConn, maxAttempts))
|
val tlStmts: ThreadLocal[Statements] = ThreadLocal.withInitial(() => new Statements(dbConn, maxAttempts))
|
||||||
|
Loading…
Reference in New Issue
Block a user