public enum DisruptorWaitStrategy extends Enum<DisruptorWaitStrategy>
WaitStrategy
used by producers on a Disruptor.
Blocking is the default WaitStrategy
.Enum Constant and Description |
---|
Blocking
Blocking strategy that uses a lock and condition variable for
EventProcessor s waiting on a barrier. |
BusySpin
Busy Spin strategy that uses a busy spin loop for
EventProcessor s waiting on a barrier. |
Sleeping
Sleeping strategy that initially spins, then uses a Thread.yield(), and eventually for the minimum number of nanos
the OS and JVM will allow while the
EventProcessor s are waiting on a barrier. |
Yielding
Yielding strategy that uses a Thread.yield() for
EventProcessor s waiting on a barrier
after an initially spinning. |
Modifier and Type | Method and Description |
---|---|
com.lmax.disruptor.WaitStrategy |
createWaitStrategyInstance() |
static DisruptorWaitStrategy |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static DisruptorWaitStrategy[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final DisruptorWaitStrategy Blocking
EventProcessor
s waiting on a barrier.
This strategy can be used when throughput and low-latency are not as important as CPU resource.public static final DisruptorWaitStrategy Sleeping
EventProcessor
s are waiting on a barrier.
This strategy is a good compromise between performance and CPU resource. Latency spikes can occur after quiet periods.public static final DisruptorWaitStrategy BusySpin
EventProcessor
s waiting on a barrier.
This strategy will use CPU resource to avoid syscalls which can introduce latency jitter. It is best
used when threads can be bound to specific CPU cores.public static final DisruptorWaitStrategy Yielding
EventProcessor
s waiting on a barrier
after an initially spinning.
This strategy is a good compromise between performance and CPU resource without incurring significant latency spikes.public static DisruptorWaitStrategy[] values()
for (DisruptorWaitStrategy c : DisruptorWaitStrategy.values()) System.out.println(c);
public static DisruptorWaitStrategy valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullApache Camel