Added cloneToNormal
, which converts the coroutine strategy -> thread strategy
This commit is contained in:
parent
1e077c2d98
commit
47b63173ac
|
@ -621,10 +621,10 @@ open class Client<CONNECTION : Connection>(config: Configuration = Configuration
|
||||||
* Removes the specified host address from the list of registered server keys.
|
* Removes the specified host address from the list of registered server keys.
|
||||||
*/
|
*/
|
||||||
fun removeRegisteredServerKey(address: InetAddress) {
|
fun removeRegisteredServerKey(address: InetAddress) {
|
||||||
val savedPublicKey = settingsStore.getRegisteredServerKey(address)
|
val savedPublicKey = storage.getRegisteredServerKey(address)
|
||||||
if (savedPublicKey != null) {
|
if (savedPublicKey != null) {
|
||||||
logger.debug { "Deleting remote IP address key $address" }
|
logger.debug { "Deleting remote IP address key $address" }
|
||||||
settingsStore.removeRegisteredServerKey(address)
|
storage.removeRegisteredServerKey(address)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,7 @@ package dorkbox.network.aeron
|
||||||
|
|
||||||
import kotlinx.coroutines.delay
|
import kotlinx.coroutines.delay
|
||||||
import kotlinx.coroutines.yield
|
import kotlinx.coroutines.yield
|
||||||
|
import org.agrona.concurrent.BackoffIdleStrategy
|
||||||
import org.agrona.hints.ThreadHints
|
import org.agrona.hints.ThreadHints
|
||||||
|
|
||||||
abstract class BackoffIdleStrategyPrePad {
|
abstract class BackoffIdleStrategyPrePad {
|
||||||
|
@ -214,8 +215,7 @@ class CoroutineBackoffIdleStrategy : BackoffIdleStrategyData, CoroutineIdleStrat
|
||||||
* @param minParkPeriodMs to use when initiating parking
|
* @param minParkPeriodMs to use when initiating parking
|
||||||
* @param maxParkPeriodMs to use for end duration when parking
|
* @param maxParkPeriodMs to use for end duration when parking
|
||||||
*/
|
*/
|
||||||
constructor(
|
constructor(maxSpins: Long, maxYields: Long, minParkPeriodMs: Long, maxParkPeriodMs: Long)
|
||||||
maxSpins: Long, maxYields: Long, minParkPeriodMs: Long, maxParkPeriodMs: Long)
|
|
||||||
: super(maxSpins, maxYields, minParkPeriodMs, maxParkPeriodMs) {
|
: super(maxSpins, maxYields, minParkPeriodMs, maxParkPeriodMs) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -333,6 +333,13 @@ class CoroutineBackoffIdleStrategy : BackoffIdleStrategyData, CoroutineIdleStrat
|
||||||
return CoroutineBackoffIdleStrategy(maxSpins = maxSpins, maxYields = maxYields, minParkPeriodMs = minParkPeriodMs, maxParkPeriodMs = maxParkPeriodMs)
|
return CoroutineBackoffIdleStrategy(maxSpins = maxSpins, maxYields = maxYields, minParkPeriodMs = minParkPeriodMs, maxParkPeriodMs = maxParkPeriodMs)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a clone of this IdleStrategy
|
||||||
|
*/
|
||||||
|
override fun cloneToNormal(): BackoffIdleStrategy {
|
||||||
|
return BackoffIdleStrategy(maxSpins, maxYields, minParkPeriodMs, maxParkPeriodMs)
|
||||||
|
}
|
||||||
|
|
||||||
override fun toString(): String {
|
override fun toString(): String {
|
||||||
return "BackoffIdleStrategy{" +
|
return "BackoffIdleStrategy{" +
|
||||||
"alias=" + ALIAS +
|
"alias=" + ALIAS +
|
||||||
|
|
|
@ -15,6 +15,8 @@
|
||||||
*/
|
*/
|
||||||
package dorkbox.network.aeron
|
package dorkbox.network.aeron
|
||||||
|
|
||||||
|
import org.agrona.concurrent.IdleStrategy
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Idle strategy for use by threads when they do not have work to do.
|
* Idle strategy for use by threads when they do not have work to do.
|
||||||
*
|
*
|
||||||
|
@ -107,4 +109,9 @@ interface CoroutineIdleStrategy {
|
||||||
* Creates a clone of this IdleStrategy
|
* Creates a clone of this IdleStrategy
|
||||||
*/
|
*/
|
||||||
fun clone(): CoroutineIdleStrategy
|
fun clone(): CoroutineIdleStrategy
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a clone of this IdleStrategy
|
||||||
|
*/
|
||||||
|
fun cloneToNormal(): IdleStrategy
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
package dorkbox.network.aeron
|
package dorkbox.network.aeron
|
||||||
|
|
||||||
import kotlinx.coroutines.delay
|
import kotlinx.coroutines.delay
|
||||||
|
import org.agrona.concurrent.SleepingMillisIdleStrategy
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When idle this strategy is to sleep for a specified period time in milliseconds.
|
* When idle this strategy is to sleep for a specified period time in milliseconds.
|
||||||
|
@ -90,6 +91,13 @@ class CoroutineSleepingMillisIdleStrategy : CoroutineIdleStrategy {
|
||||||
return CoroutineSleepingMillisIdleStrategy(sleepPeriodMs = sleepPeriodMs)
|
return CoroutineSleepingMillisIdleStrategy(sleepPeriodMs = sleepPeriodMs)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a clone of this IdleStrategy
|
||||||
|
*/
|
||||||
|
override fun cloneToNormal(): SleepingMillisIdleStrategy {
|
||||||
|
return SleepingMillisIdleStrategy(sleepPeriodMs)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
override fun toString(): String {
|
override fun toString(): String {
|
||||||
return "SleepingMillisIdleStrategy{" +
|
return "SleepingMillisIdleStrategy{" +
|
||||||
|
|
Loading…
Reference in New Issue
Block a user