本文整理了Java中com.lmax.disruptor.YieldingWaitStrategy.<init>()
方法的一些代码示例,展示了YieldingWaitStrategy.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YieldingWaitStrategy.<init>()
方法的具体详情如下:
包路径:com.lmax.disruptor.YieldingWaitStrategy
类名称:YieldingWaitStrategy
方法名:<init>
暂无
代码示例来源:origin: crossoverJie/JCSprout
new YieldingWaitStrategy());
代码示例来源:origin: Graylog2/graylog2-server
private WaitStrategy getWaitStrategy(String waitStrategyName, String configOptionName) {
switch (waitStrategyName) {
case "sleeping":
return new SleepingWaitStrategy();
case "yielding":
return new YieldingWaitStrategy();
case "blocking":
return new BlockingWaitStrategy();
case "busy_spinning":
return new BusySpinWaitStrategy();
default:
LOG.warn("Invalid setting for [{}]:"
+ " Falling back to default: BlockingWaitStrategy.", configOptionName);
return new BlockingWaitStrategy();
}
}
代码示例来源:origin: Graylog2/graylog2-server
protected WaitStrategy getWaitStrategy(String waitStrategyName, String configOptionName) {
switch (waitStrategyName) {
case "sleeping":
return new SleepingWaitStrategy();
case "yielding":
return new YieldingWaitStrategy();
case "blocking":
return new BlockingWaitStrategy();
case "busy_spinning":
return new BusySpinWaitStrategy();
default:
log.warn("Invalid setting for [{}]:"
+ " Falling back to default: BlockingWaitStrategy.", configOptionName);
return new BlockingWaitStrategy();
}
}
代码示例来源:origin: LMAX-Exchange/disruptor
@Test
public void shouldWaitForValue() throws Exception
{
assertWaitForWithDelayOf(50, new YieldingWaitStrategy());
}
}
代码示例来源:origin: fengjiachun/Jupiter
break;
case YIELDING_WAIT:
waitStrategy = new YieldingWaitStrategy();
break;
case BUSY_SPIN_WAIT:
代码示例来源:origin: fengjiachun/Jupiter
break;
case YIELDING_WAIT:
waitStrategy = new YieldingWaitStrategy();
break;
case BUSY_SPIN_WAIT:
代码示例来源:origin: org.projectreactor/reactor-core
/**
* Set {@link com.lmax.disruptor.YieldingWaitStrategy} as wait strategy.
*
* @return {@literal this}
*/
public ProcessorSpec<T> yieldingWaitStrategy() {
this.waitStrategy = new YieldingWaitStrategy();
return this;
}
代码示例来源:origin: com.srotya/linea
@SuppressWarnings("unchecked")
public BoltExecutorWrapper(TupleFactory<E> factory, ExecutorService pool, Bolt<E> processor) {
this.pool = pool;
this.bolt = processor;
disruptor = new Disruptor<>(factory, 1024 * 8, pool, ProducerType.MULTI, new YieldingWaitStrategy());
disruptor.handleEventsWith(this);
}
代码示例来源:origin: camunda/camunda-bpm-reactor
public AgileWaitingStrategy() {
this(new BlockingWaitStrategy(), new YieldingWaitStrategy());
}
代码示例来源:origin: mzheravin/exchange-core
public WaitStrategy create() {
switch (this) {
case SLEEPING:
return new SleepingWaitStrategy();
case BUSY_SPIN:
return new BusySpinWaitStrategy();
case YIELDING:
default:
return new YieldingWaitStrategy();
}
}
代码示例来源:origin: org.graylog2/graylog2-server
private WaitStrategy getWaitStrategy(String waitStrategyName, String configOptionName) {
switch (waitStrategyName) {
case "sleeping":
return new SleepingWaitStrategy();
case "yielding":
return new YieldingWaitStrategy();
case "blocking":
return new BlockingWaitStrategy();
case "busy_spinning":
return new BusySpinWaitStrategy();
default:
LOG.warn("Invalid setting for [{}]:"
+ " Falling back to default: BlockingWaitStrategy.", configOptionName);
return new BlockingWaitStrategy();
}
}
代码示例来源:origin: org.graylog2/graylog2-server
protected WaitStrategy getWaitStrategy(String waitStrategyName, String configOptionName) {
switch (waitStrategyName) {
case "sleeping":
return new SleepingWaitStrategy();
case "yielding":
return new YieldingWaitStrategy();
case "blocking":
return new BlockingWaitStrategy();
case "busy_spinning":
return new BusySpinWaitStrategy();
default:
log.warn("Invalid setting for [{}]:"
+ " Falling back to default: BlockingWaitStrategy.", configOptionName);
return new BlockingWaitStrategy();
}
}
代码示例来源:origin: org.apache.omid/tso-server
@Inject
RetryProcessorImpl(MetricsRegistry metrics,
CommitTable commitTable,
ReplyProcessor replyProc,
Panicker panicker,
ObjectPool<Batch> batchPool)
throws InterruptedException, ExecutionException, IOException {
this.commitTableClient = commitTable.getClient();
this.replyProc = replyProc;
this.batchPool = batchPool;
retryRing = RingBuffer.createSingleProducer(RetryEvent.EVENT_FACTORY, 1 << 12, new YieldingWaitStrategy());
SequenceBarrier retrySequenceBarrier = retryRing.newBarrier();
BatchEventProcessor<RetryEvent> retryProcessor = new BatchEventProcessor<>(retryRing, retrySequenceBarrier, this);
retryProcessor.setExceptionHandler(new FatalExceptionHandler(panicker));
retryRing.addGatingSequences(retryProcessor.getSequence());
ThreadFactory threadFactory = new ThreadFactoryBuilder().setNameFormat("retry-%d").build();
ExecutorService retryExec = Executors.newSingleThreadExecutor(threadFactory);
retryExec.submit(retryProcessor);
// Metrics configuration
retriesMeter = metrics.meter(name("tso", "retries"));
}
代码示例来源:origin: devicehive/devicehive-java-server
private WaitStrategy getWaitStrategy() {
logger.info("RPC server wait strategy: {}", waitStrategy);
WaitStrategy strategy;
switch (waitStrategy) {
case "blocking":
strategy = new BlockingWaitStrategy();
break;
case "sleeping":
strategy = new SleepingWaitStrategy();
break;
case "yielding":
strategy = new YieldingWaitStrategy();
break;
case "busyspin":
strategy = new BusySpinWaitStrategy();
break;
default:
strategy = new BlockingWaitStrategy();
break;
}
return strategy;
}
代码示例来源:origin: dmart28/reveno
protected WaitStrategy createWaitStrategy() {
switch (cpuConsumption()) {
case LOW:
return new BlockingWaitStrategy();
case NORMAL:
return new SleepingWaitStrategy();
case HIGH:
return new YieldingWaitStrategy();
case PHASED:
return PhasedBackoffWaitStrategy.withLiteLock((int) 2.5e5, (int) 8.5e5,
TimeUnit.NANOSECONDS);
}
return null;
}
代码示例来源:origin: ops4j/org.ops4j.pax.logging
static WaitStrategy createWaitStrategy(final String propertyName, final long timeoutMillis) {
final String strategy = PropertiesUtil.getProperties().getStringProperty(propertyName, "TIMEOUT");
LOGGER.trace("property {}={}", propertyName, strategy);
final String strategyUp = strategy.toUpperCase(Locale.ROOT); // TODO Refactor into Strings.toRootUpperCase(String)
switch (strategyUp) { // TODO Define a DisruptorWaitStrategy enum?
case "SLEEP":
return new SleepingWaitStrategy();
case "YIELD":
return new YieldingWaitStrategy();
case "BLOCK":
return new BlockingWaitStrategy();
case "BUSYSPIN":
return new BusySpinWaitStrategy();
case "TIMEOUT":
return new TimeoutBlockingWaitStrategy(timeoutMillis, TimeUnit.MILLISECONDS);
default:
return new TimeoutBlockingWaitStrategy(timeoutMillis, TimeUnit.MILLISECONDS);
}
}
代码示例来源:origin: devicehive/devicehive-java-server
private WaitStrategy getWaitStrategy(String strategy) {
WaitStrategy waitStrategy;
switch (strategy) {
case "blocking":
waitStrategy = new BlockingWaitStrategy();
break;
case "sleeping":
waitStrategy = new SleepingWaitStrategy();
break;
case "yielding":
waitStrategy = new YieldingWaitStrategy();
break;
case "busyspin":
waitStrategy = new BusySpinWaitStrategy();
break;
default:
waitStrategy = new BlockingWaitStrategy();
break;
}
return waitStrategy;
}
}
代码示例来源:origin: devicehive/devicehive-java-server
private WaitStrategy getWaitStrategy() {
WaitStrategy strategy;
switch (proxyConfig.getWaitStrategy()) {
case "blocking":
strategy = new BlockingWaitStrategy();
break;
case "sleeping":
strategy = new SleepingWaitStrategy();
break;
case "yielding":
strategy = new YieldingWaitStrategy();
break;
case "busyspin":
strategy = new BusySpinWaitStrategy();
break;
default:
strategy = new BlockingWaitStrategy();
break;
}
return strategy;
}
}
代码示例来源:origin: org.fabric3/fabric3-channel-disruptor
private WaitStrategy createWaitStrategy(RingBufferData data) {
switch (data.getWaitStrategy()) {
case YIELDING:
return new YieldingWaitStrategy();
case SLEEPING:
return new SleepingWaitStrategy();
case BACKOFF:
if (RingBufferData.PhasedBlockingType.LOCK == data.getPhasedBlockingType()) {
return PhasedBackoffWaitStrategy.withLock(data.getSpinTimeoutNanos(), data.getYieldTimeoutNanos(), TimeUnit.NANOSECONDS);
} else {
return PhasedBackoffWaitStrategy.withSleep(data.getSpinTimeoutNanos(), data.getYieldTimeoutNanos(), TimeUnit.NANOSECONDS);
}
case SPIN:
return new BusySpinWaitStrategy();
case TIMEOUT:
return new TimeoutBlockingWaitStrategy(data.getBlockingTimeoutNanos(), TimeUnit.NANOSECONDS);
default:
return new BlockingWaitStrategy();
}
}
代码示例来源:origin: org.codehaus.fabric3/fabric3-channel-disruptor
private WaitStrategy createWaitStrategy(RingBufferData data) {
switch (data.getWaitStrategy()) {
case YIELDING:
return new YieldingWaitStrategy();
case SLEEPING:
return new SleepingWaitStrategy();
case BACKOFF:
if (RingBufferData.PhasedBlockingType.LOCK == data.getPhasedBlockingType()) {
return PhasedBackoffWaitStrategy.withLock(data.getSpinTimeoutNanos(), data.getYieldTimeoutNanos(), TimeUnit.NANOSECONDS);
} else {
return PhasedBackoffWaitStrategy.withSleep(data.getSpinTimeoutNanos(), data.getYieldTimeoutNanos(), TimeUnit.NANOSECONDS);
}
case SPIN:
return new BusySpinWaitStrategy();
case TIMEOUT:
return new TimeoutBlockingWaitStrategy(data.getBlockingTimeoutNanos(), TimeUnit.NANOSECONDS);
default:
return new BlockingWaitStrategy();
}
}
内容来源于网络,如有侵权,请联系作者删除!