public class BackoffIdleStrategy extends Object implements IdleStrategy
Thread.yield()
for maxYields, then
LockSupport.parkNanos(long)
on an exponential backoff to maxParkPeriodNsConstructor and Description |
---|
BackoffIdleStrategy(long maxSpins,
long maxYields,
long minParkPeriodNs,
long maxParkPeriodNs)
Create a set of state tracking idle behavior
|
Modifier and Type | Method and Description |
---|---|
static BackoffIdleStrategy |
createBackoffIdleStrategy(String config)
Creates a new BackoffIdleStrategy.
|
boolean |
idle(long n)
Perform current idle strategy's step n.
|
public BackoffIdleStrategy(long maxSpins, long maxYields, long minParkPeriodNs, long maxParkPeriodNs)
maxSpins
- to perform before moving to Thread.yield()
maxYields
- to perform before moving to LockSupport.parkNanos(long)
minParkPeriodNs
- to use when initiating parkingmaxParkPeriodNs
- to use when parkingpublic boolean idle(long n)
idle
in interface IdleStrategy
n
- number of times this method has been previously called with no intervening work done.public static BackoffIdleStrategy createBackoffIdleStrategy(String config)
Copyright © 2020 Hazelcast, Inc.. All Rights Reserved.