Enum DisruptorWaitStrategy
- java.lang.Object
-
- java.lang.Enum<DisruptorWaitStrategy>
-
- org.apache.camel.component.disruptor.DisruptorWaitStrategy
-
- All Implemented Interfaces:
Serializable
,Comparable<DisruptorWaitStrategy>
public enum DisruptorWaitStrategy extends Enum<DisruptorWaitStrategy>
This enumeration holds all values that may be used as theWaitStrategy
used by producers on a Disruptor. Blocking is the defaultWaitStrategy
.
-
-
Enum Constant Summary
Enum Constants Enum Constant Description Blocking
Blocking strategy that uses a lock and condition variable forEventProcessor
s waiting on a barrier.BusySpin
Busy Spin strategy that uses a busy spin loop forEventProcessor
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 theEventProcessor
s are waiting on a barrier.Yielding
Yielding strategy that uses a Thread.yield() forEventProcessor
s waiting on a barrier after an initially spinning.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description com.lmax.disruptor.WaitStrategy
createWaitStrategyInstance()
Class<? extends com.lmax.disruptor.WaitStrategy>
getWaitStrategyClass()
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.
-
-
-
Enum Constant Detail
-
Blocking
public static final DisruptorWaitStrategy Blocking
Blocking strategy that uses a lock and condition variable forEventProcessor
s waiting on a barrier. This strategy can be used when throughput and low-latency are not as important as CPU resource.
-
Sleeping
public static final DisruptorWaitStrategy 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 theEventProcessor
s are waiting on a barrier. This strategy is a good compromise between performance and CPU resource. Latency spikes can occur after quiet periods.
-
BusySpin
public static final DisruptorWaitStrategy BusySpin
Busy Spin strategy that uses a busy spin loop forEventProcessor
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.
-
Yielding
public static final DisruptorWaitStrategy Yielding
Yielding strategy that uses a Thread.yield() forEventProcessor
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.
-
-
Method Detail
-
values
public static DisruptorWaitStrategy[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (DisruptorWaitStrategy c : DisruptorWaitStrategy.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static DisruptorWaitStrategy valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-
getWaitStrategyClass
public Class<? extends com.lmax.disruptor.WaitStrategy> getWaitStrategyClass()
-
-