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.
25 lines
628 B
25 lines
628 B
package dev.openrs2.db
|
|
|
|
/**
|
|
* A [BackoffStrategy] with a fixed delay.
|
|
*
|
|
* It permits a delay of zero, which is appropriate for use with database
|
|
* servers that allow one of the deadlocked connections to proceed (thus
|
|
* guaranteeing forward progress) and where you only expect a small amount of
|
|
* lock contention.
|
|
*/
|
|
public class FixedBackoffStrategy(
|
|
/**
|
|
* The delay in milliseconds. Must be zero or positive.
|
|
*/
|
|
private val delay: Long
|
|
) : BackoffStrategy {
|
|
init {
|
|
delay >= 0
|
|
}
|
|
|
|
override fun getDelay(attempt: Int): Long {
|
|
require(attempt >= 0)
|
|
return delay
|
|
}
|
|
}
|
|
|