C# 클래스 Disruptor.MultiProducerSequencer

Coordinator for claiming sequences for access to a data structure while tracking dependent Sequences. Suitable for use for sequencing across multiple publisher threads.

Note on Sequencer.Cursor: With this sequencer the cursor value is updated after the call to Sequencer.Next(), to determine the highest available sequence that can be read, then GetHighestPublishedSequence should be used.
상속: Disruptor.Sequencer
파일 보기 프로젝트 열기: disruptor-net/Disruptor-net 1 사용 예제들

공개 메소드들

메소드 설명
Claim ( long sequence ) : void

Claim a specific sequence when only one publisher is involved.

GetHighestPublishedSequence ( long lowerBound, long availableSequence ) : long

Get the highest sequence number that can be safely read from the ring buffer. Depending on the implementation of the Sequencer this call may need to scan a number of values in the Sequencer. The scan will range from nextSequence to availableSequence. If there are no available values >= nextSequence the return value will be nextSequence - 1. To work correctly a consumer should pass a value that it 1 higher than the last sequence that was successfully processed.

GetRemainingCapacity ( ) : long

Get the remaining capacity for this sequencer. return The number of slots remaining.

HasAvailableCapacity ( int requiredCapacity ) : bool

Has the buffer got capacity to allocate another sequence. This is a concurrent method so the response should only be taken as an indication of available capacity.

IsAvailable ( long sequence ) : bool

Confirms if a sequence is published and the event is available for use; non-blocking.

MultiProducerSequencer ( int bufferSize, IWaitStrategy waitStrategy ) : System
Next ( ) : long

Claim the next event in sequence for publishing.

Next ( int n ) : long

Claim the next n events in sequence for publishing. This is for batch event producing. Using batch producing requires a little care and some math. int n = 10; long hi = sequencer.next(n); long lo = hi - (n - 1); for (long sequence = lo; sequence <= hi; sequence++) { // Do work. } sequencer.publish(lo, hi);

Publish ( long sequence ) : void

Publish an event and make it visible to IEventProcessors

Publish ( long lo, long hi ) : void

Publish an event and make it visible to IEventProcessors

TryNext ( ) : long

Attempt to claim the next event in sequence for publishing. Will return the number of the slot if there is at leastrequiredCapacity slots available.

TryNext ( int n ) : long

Attempt to claim the next event in sequence for publishing. Will return the number of the slot if there is at least slots available.

비공개 메소드들

메소드 설명
CalculateAvailabilityFlag ( long sequence ) : int
CalculateIndex ( long sequence ) : int
HasAvailableCapacity ( ISequence gatingSequences, int requiredCapacity, long cursorValue ) : bool
InitialiseAvailableBuffer ( ) : void
SetAvailable ( long sequence ) : void
SetAvailableBufferValue ( int index, int flag ) : void

메소드 상세

Claim() 공개 메소드

Claim a specific sequence when only one publisher is involved.
public Claim ( long sequence ) : void
sequence long sequence to be claimed.
리턴 void

GetHighestPublishedSequence() 공개 메소드

Get the highest sequence number that can be safely read from the ring buffer. Depending on the implementation of the Sequencer this call may need to scan a number of values in the Sequencer. The scan will range from nextSequence to availableSequence. If there are no available values &gt;= nextSequence the return value will be nextSequence - 1. To work correctly a consumer should pass a value that it 1 higher than the last sequence that was successfully processed.
public GetHighestPublishedSequence ( long lowerBound, long availableSequence ) : long
lowerBound long
availableSequence long The sequence to scan to.
리턴 long

GetRemainingCapacity() 공개 메소드

Get the remaining capacity for this sequencer. return The number of slots remaining.
public GetRemainingCapacity ( ) : long
리턴 long

HasAvailableCapacity() 공개 메소드

Has the buffer got capacity to allocate another sequence. This is a concurrent method so the response should only be taken as an indication of available capacity.
public HasAvailableCapacity ( int requiredCapacity ) : bool
requiredCapacity int requiredCapacity in the buffer
리턴 bool

IsAvailable() 공개 메소드

Confirms if a sequence is published and the event is available for use; non-blocking.
public IsAvailable ( long sequence ) : bool
sequence long sequence of the buffer to check
리턴 bool

MultiProducerSequencer() 공개 메소드

public MultiProducerSequencer ( int bufferSize, IWaitStrategy waitStrategy ) : System
bufferSize int
waitStrategy IWaitStrategy
리턴 System

Next() 공개 메소드

Claim the next event in sequence for publishing.
public Next ( ) : long
리턴 long

Next() 공개 메소드

Claim the next n events in sequence for publishing. This is for batch event producing. Using batch producing requires a little care and some math. int n = 10; long hi = sequencer.next(n); long lo = hi - (n - 1); for (long sequence = lo; sequence <= hi; sequence++) { // Do work. } sequencer.publish(lo, hi);
public Next ( int n ) : long
n int the number of sequences to claim
리턴 long

Publish() 공개 메소드

Publish an event and make it visible to IEventProcessors
public Publish ( long sequence ) : void
sequence long sequence to be published
리턴 void

Publish() 공개 메소드

Publish an event and make it visible to IEventProcessors
public Publish ( long lo, long hi ) : void
lo long
hi long
리턴 void

TryNext() 공개 메소드

Attempt to claim the next event in sequence for publishing. Will return the number of the slot if there is at leastrequiredCapacity slots available.
public TryNext ( ) : long
리턴 long

TryNext() 공개 메소드

Attempt to claim the next event in sequence for publishing. Will return the number of the slot if there is at least slots available.
public TryNext ( int n ) : long
n int the number of sequences to claim
리턴 long