public final class UtlDisruptor extends Object
This class IS supported for use by end users..
| Constructor and Description |
|---|
UtlDisruptor() |
| Modifier and Type | Method and Description |
|---|---|
static <T> com.lmax.disruptor.dsl.Disruptor<T> |
createSingleConsumerDisruptor(com.lmax.disruptor.EventFactory<T> eventFactory,
int size,
ThreadFactory threadFactory,
com.lmax.disruptor.dsl.ProducerType producerType,
com.lmax.disruptor.WaitStrategy waitStrategy,
com.lmax.disruptor.EventHandler<T> eventHandler)
Create a single consumer disruptor
|
static com.lmax.disruptor.WaitStrategy |
getWaitStrategy(String configuredWaitStrategy,
boolean optimize)
Get the
WaitStrategy to use with a disruptor. |
static com.lmax.disruptor.dsl.ProducerType |
legacyClaimStrategyStrToProducerType(String claimStrategyStr)
Convert a (legacy) claim strategy configuration string to a disruptor producer type
|
static String |
toProducerTypeStr(com.lmax.disruptor.dsl.ProducerType producerType)
Get a string representation for a disruptor producer type
|
static String |
waitStrategyToStr(com.lmax.disruptor.WaitStrategy waitStrategy)
Convert a disruptor wait strategy to a string
|
public static final com.lmax.disruptor.dsl.ProducerType legacyClaimStrategyStrToProducerType(String claimStrategyStr)
public static final String toProducerTypeStr(com.lmax.disruptor.dsl.ProducerType producerType)
public static final com.lmax.disruptor.WaitStrategy getWaitStrategy(String configuredWaitStrategy, boolean optimize) throws IllegalArgumentException
WaitStrategy to use with a disruptor.
This call allows the platform to optimize disruptor wait strategy create based on the Optimization
currently set for the runtime by 'nv.optimizefor' when the passed in value for optimize is true:
BlockingWaitStrategy
to avoid spinning cores. This can be useful for test environments such as a user's workstation where spinning
cores may be costly.
true and configuredWaitStrategy is null:
#tuneForLatency() is true a BusySpinWaitStrategy is returned.
#tuneForThroughput() is true a YieldingWaitStrategy is returned.
configuredWaitStrategy - The configured wait strategy which will be returned if the wait strategy isn't optimized.
Must be one of Blocking, Sleeping, Yielding or BusySpin.optimize - If true will optimize the configured wait strategy according to the 'nv.optimizefor'
environment variable unless nv.tuning.disablewaitstrategyoptimizations=true has been set in which case such optimizations
are disabled.WaitStrategy for the given configuredWaitStrategy.IllegalArgumentException - if the configuredWaitStrategy is not one of Blocking, Sleeping, Yielding or BusySpin.public static final String waitStrategyToStr(com.lmax.disruptor.WaitStrategy waitStrategy)
public static final <T> com.lmax.disruptor.dsl.Disruptor<T> createSingleConsumerDisruptor(com.lmax.disruptor.EventFactory<T> eventFactory,
int size,
ThreadFactory threadFactory,
com.lmax.disruptor.dsl.ProducerType producerType,
com.lmax.disruptor.WaitStrategy waitStrategy,
com.lmax.disruptor.EventHandler<T> eventHandler)
eventFactory - The event factory to usesize - The disruptor sizethreadFactory - The thread factory to use to create consumer threadproducerType - The producer typewaitStrategy - The wait strategy to useeventHandler - The handler of the events passed through the disruptorCopyright © 2019 N5 Technologies, Inc. All Rights Reserved.