com.lmax.disruptor
Class MultiThreadedClaimStrategy
java.lang.Object
com.lmax.disruptor.AbstractMultithreadedClaimStrategy
com.lmax.disruptor.MultiThreadedClaimStrategy
- All Implemented Interfaces:
- ClaimStrategy
public final class MultiThreadedClaimStrategy
- extends AbstractMultithreadedClaimStrategy
- implements ClaimStrategy
Strategy to be used when there are multiple publisher threads claiming sequences.
This strategy is reasonably forgiving when the multiple publisher threads are highly contended or working in an
environment where there is insufficient CPUs to handle multiple publisher threads. It requires 2 CAS operations
for a single publisher, compared to the MultiThreadedLowContentionClaimStrategy strategy which needs only a single
CAS and a lazySet per publication.
|
Method Summary |
void |
serialisePublishing(long sequence,
Sequence cursor,
int batchSize)
Serialise publishers in sequence and set cursor to latest available sequence. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MultiThreadedClaimStrategy
public MultiThreadedClaimStrategy(int bufferSize,
int pendingBufferSize)
- Construct a new multi-threaded publisher
ClaimStrategy for a given buffer size.
- Parameters:
bufferSize - for the underlying data structure.pendingBufferSize - number of item that can be pending for serialisation
MultiThreadedClaimStrategy
public MultiThreadedClaimStrategy(int bufferSize)
- Construct a new multi-threaded publisher
ClaimStrategy for a given buffer size.
- Parameters:
bufferSize - for the underlying data structure.
serialisePublishing
public void serialisePublishing(long sequence,
Sequence cursor,
int batchSize)
- Description copied from interface:
ClaimStrategy
- Serialise publishers in sequence and set cursor to latest available sequence.
- Specified by:
serialisePublishing in interface ClaimStrategy
- Parameters:
sequence - sequence to be appliedcursor - to serialise against.batchSize - of the sequence.
Copyright © 2011 LMAX Ltd. All Rights Reserved.