Open-source multiplayer game server compatible with the RuneScape client
https://www.openrs2.org/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
467 B
16 lines
467 B
package dev.openrs2.db
|
|
|
|
import java.sql.SQLException
|
|
|
|
/**
|
|
* A [DeadlockDetector] implementation for H2.
|
|
*/
|
|
public object H2DeadlockDetector : DeadlockDetector {
|
|
private const val DEADLOCK_1 = 40001
|
|
private const val LOCK_TIMEOUT_1 = 50200
|
|
|
|
override fun isDeadlock(ex: SQLException): Boolean {
|
|
// see https://www.h2database.com/javadoc/org/h2/api/ErrorCode.html
|
|
return ex.errorCode == DEADLOCK_1 || ex.errorCode == LOCK_TIMEOUT_1
|
|
}
|
|
}
|
|
|