Java 类com.lmax.disruptor.ClaimStrategy 实例源码

项目:incubator-storm    文件:DisruptorQueue.java   
public DisruptorQueue(ClaimStrategy claim, WaitStrategy wait) {
    _buffer = new RingBuffer<MutableObject>(new ObjectEventFactory(), claim, wait);
    _consumer = new Sequence();
    _barrier = _buffer.newBarrier();
    _buffer.setGatingSequences(_consumer);
    if(claim instanceof SingleThreadedClaimStrategy) {
        consumerStartedFlag = true;
    }
}
项目:storm-resa    文件:TracedDisruptorQueue.java   
public TracedDisruptorQueue(ClaimStrategy claim, WaitStrategy wait, Map<String, Object> conf) {
    super(claim, wait);
    float sampleRate = 0.05f;
    if (conf.containsKey("topology.queue.sample.rate")) {
        sampleRate = ((Number) conf.get("topology.queue.sample.rate")).floatValue();
    }
    this.sampleInterval = Math.max((int) (1 / sampleRate), 2);
}
项目:storm-resa    文件:DisruptorQueue.java   
public DisruptorQueue(ClaimStrategy claim, WaitStrategy wait) {
    _buffer = new RingBuffer<MutableObject>(new ObjectEventFactory(), claim, wait);
    _consumer = new Sequence();
    _barrier = _buffer.newBarrier();
    _buffer.setGatingSequences(_consumer);
    if(claim instanceof SingleThreadedClaimStrategy) {
        consumerStartedFlag = true;
    }
}