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.
 
 
 
 
openrs2/db/src/main/java/dev/openrs2/db/MysqlDeadlockDetector.kt

16 lines
508 B

package dev.openrs2.db
import java.sql.SQLException
/**
* A [DeadlockDetector] implementation for MySQL and MariaDB.
*/
public object MysqlDeadlockDetector : DeadlockDetector {
private const val LOCK_WAIT_TIMEOUT = 1205
private const val LOCK_DEADLOCK = 1213
override fun isDeadlock(ex: SQLException): Boolean {
// see https://dev.mysql.com/doc/mysql-errors/8.0/en/server-error-reference.html
return ex.errorCode == LOCK_WAIT_TIMEOUT || ex.errorCode == LOCK_DEADLOCK
}
}