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/DeadlockDetector.kt

21 lines
735 B

package dev.openrs2.db
import java.sql.SQLException
/**
* A functional interface for checking if an [SQLException] represents a
* deadlock. There is no standard mechanism for representing deadlock errors,
* so vendor-specific implementations are required.
*
* The [Database] class already examines the entire [Throwable.cause] and
* [SQLException.next] chain, so implementations only need to examine the
* individual [SQLException] passed to them.
*/
public fun interface DeadlockDetector {
/**
* Determines whether the [SQLException] was caused by a deadlock or not.
* @param ex the [SQLException].
* @return `true` if so, `false` otherwise.
*/
public fun isDeadlock(ex: SQLException): Boolean
}