本文整理了Java中com.lmax.disruptor.WaitStrategy
类的一些代码示例,展示了WaitStrategy
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WaitStrategy
类的具体详情如下:
包路径:com.lmax.disruptor.WaitStrategy
类名称:WaitStrategy
[英]Strategy employed for making EventProcessors wait on a cursor Sequence.
[中]使事件处理器等待光标序列的策略。
代码示例来源:origin: LMAX-Exchange/disruptor
@Override
public void signalAllWhenBlocking()
{
fallbackStrategy.signalAllWhenBlocking();
}
}
代码示例来源:origin: LMAX-Exchange/disruptor
@Override
public long waitFor(final long sequence)
throws AlertException, InterruptedException, TimeoutException
{
checkAlert();
long availableSequence = waitStrategy.waitFor(sequence, cursorSequence, dependentSequence, this);
if (availableSequence < sequence)
{
return availableSequence;
}
return sequencer.getHighestPublishedSequence(sequence, availableSequence);
}
代码示例来源:origin: mzheravin/exchange-core
@Override
public long tryWaitFor(long sequence, long spin) throws AlertException, InterruptedException, TimeoutException {
checkAlert();
long availableSequence = waitStrategy.tryWaitFor(sequence, cursorSequence, dependentSequence, this, spin);
if (availableSequence < sequence) {
return availableSequence;
}
return sequencer.getHighestPublishedSequence(sequence, availableSequence);
}
代码示例来源:origin: LMAX-Exchange/disruptor
@Override
public void alert()
{
alerted = true;
waitStrategy.signalAllWhenBlocking();
}
代码示例来源:origin: LMAX-Exchange/disruptor
if (timeDelta > yieldTimeoutNanos)
return fallbackStrategy.waitFor(sequence, cursor, dependentSequence, barrier);
代码示例来源:origin: LMAX-Exchange/disruptor
/**
* @see Sequencer#publish(long)
*/
@Override
public void publish(final long sequence)
{
setAvailable(sequence);
waitStrategy.signalAllWhenBlocking();
}
代码示例来源:origin: LMAX-Exchange/disruptor
public static void assertWaitForWithDelayOf(long sleepTimeMillis, WaitStrategy waitStrategy)
throws InterruptedException, BrokenBarrierException, AlertException, TimeoutException
{
SequenceUpdater sequenceUpdater = new SequenceUpdater(sleepTimeMillis, waitStrategy);
EXECUTOR.execute(sequenceUpdater);
sequenceUpdater.waitForStartup();
Sequence cursor = new Sequence(0);
long sequence = waitStrategy.waitFor(0, cursor, sequenceUpdater.sequence, new DummySequenceBarrier());
assertThat(sequence, is(0L));
}
}
代码示例来源:origin: LMAX-Exchange/disruptor
/**
* @see Sequencer#publish(long, long)
*/
@Override
public void publish(long lo, long hi)
{
for (long l = lo; l <= hi; l++)
{
setAvailable(l);
}
waitStrategy.signalAllWhenBlocking();
}
代码示例来源:origin: com.lmax/disruptor
@Override
public long waitFor(final long sequence)
throws AlertException, InterruptedException, TimeoutException
{
checkAlert();
long availableSequence = waitStrategy.waitFor(sequence, cursorSequence, dependentSequence, this);
if (availableSequence < sequence)
{
return availableSequence;
}
return sequencer.getHighestPublishedSequence(sequence, availableSequence);
}
代码示例来源:origin: LMAX-Exchange/disruptor
/**
* @see Sequencer#publish(long)
*/
@Override
public void publish(long sequence)
{
cursor.set(sequence);
waitStrategy.signalAllWhenBlocking();
}
代码示例来源:origin: com.lmax/disruptor
if (timeDelta > yieldTimeoutNanos)
return fallbackStrategy.waitFor(sequence, cursor, dependentSequence, barrier);
代码示例来源:origin: alibaba/jstorm
/**
* @see Sequencer#publish(long)
*/
@Override
public void publish(final long sequence) {
setAvailable(sequence);
waitStrategy.signalAllWhenBlocking();
}
代码示例来源:origin: camunda/camunda-bpm-reactor
@Override
public long waitFor(long sequence, Sequence cursor, Sequence dependentSequence, SequenceBarrier barrier)
throws AlertException, InterruptedException, TimeoutException {
return currentStrategy.waitFor(sequence, cursor, dependentSequence, barrier);
}
代码示例来源:origin: alibaba/jstorm
/**
* @see Sequencer#publish(long)
*/
@Override
public void publish(long sequence) {
cursor.set(sequence);
waitStrategy.signalAllWhenBlocking();
}
代码示例来源:origin: harbby/presto-connectors
@Override
public long waitFor(final long sequence)
throws AlertException, InterruptedException, TimeoutException
{
checkAlert();
long availableSequence = waitStrategy.waitFor(sequence, cursorSequence, dependentSequence, this);
if (availableSequence < sequence)
{
return availableSequence;
}
return sequencer.getHighestPublishedSequence(sequence, availableSequence);
}
代码示例来源:origin: alibaba/jstorm
/**
* @see Sequencer#publish(long, long)
*/
@Override
public void publish(long lo, long hi) {
for (long l = lo; l <= hi; l++) {
setAvailable(l);
}
waitStrategy.signalAllWhenBlocking();
}
代码示例来源:origin: mzheravin/exchange-core
@Override
public long waitFor(final long sequence)
throws AlertException, InterruptedException, TimeoutException {
checkAlert();
long availableSequence = waitStrategy.waitFor(sequence, cursorSequence, dependentSequence, this);
if (availableSequence < sequence) {
return availableSequence;
}
return sequencer.getHighestPublishedSequence(sequence, availableSequence);
}
代码示例来源:origin: LMAX-Exchange/disruptor
@Override
public void run()
{
try
{
barrier.await();
if (0 != sleepTime)
{
Thread.sleep(sleepTime);
}
sequence.incrementAndGet();
waitStrategy.signalAllWhenBlocking();
}
catch (Exception e)
{
e.printStackTrace();
}
}
代码示例来源:origin: xiaoguichao/mr
@Override
public long waitFor(final long sequence)
throws AlertException, InterruptedException, TimeoutException
{
checkAlert();
long availableSequence = waitStrategy.waitFor(sequence, cursorSequence, dependentSequence, this);
if (availableSequence < sequence)
{
return availableSequence;
}
return sequencer.getHighestPublishedSequence(sequence, availableSequence);
}
代码示例来源:origin: com.lmax/disruptor
@Override
public void signalAllWhenBlocking()
{
fallbackStrategy.signalAllWhenBlocking();
}
}
内容来源于网络,如有侵权,请联系作者删除!