Changeset 533 for Tests


Ignore:
Timestamp:
04/03/12 21:44:45 (10 years ago)
Author:
BegemoT
Message:
 
Location:
Tests/JAVA/test/src/main/java/test/threads/queue/unstressed
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • Tests/JAVA/test/src/main/java/test/threads/queue/unstressed/DisruptorTask.java

    r522 r533  
    2222    private final WaitStrategy waitStrategy; 
    2323    private final boolean publishInBatch; 
     24    private final boolean subsribeInBatch; 
    2425 
    2526    public DisruptorTask( final Config config ) throws ClassNotFoundException, InstantiationException, IllegalAccessException { 
     
    3233 
    3334        this.publishInBatch = config.getAsBoolean( "disruptor.publish-in-batch", false ); 
     35        this.subsribeInBatch = config.getAsBoolean( "disruptor.subscribe-in-batch", true ); 
    3436    } 
    3537 
     
    6668 
    6769        long sum = 0; 
    68         long nextSequence = lastSequence.get() + 1L; 
    69         while ( nextSequence <= maxSequence ) { 
    70             final long availableSequence = Math.min( 
    71                     lastSequenceBarrier.waitFor( nextSequence ), 
    72                     maxSequence 
    73             ); 
    74             while ( nextSequence <= availableSequence ) { 
     70        if ( subsribeInBatch ) { 
     71            long nextSequence = lastSequence.get() + 1L; 
     72            while ( nextSequence <= maxSequence ) { 
     73                final long availableSequence = Math.min( 
     74                        lastSequenceBarrier.waitFor( nextSequence ), 
     75                        maxSequence 
     76                ); 
     77                while ( nextSequence <= availableSequence ) { 
     78                    final LongValueMessage event = ringBuffer.get( nextSequence ); 
     79                    sum += event.value; 
     80                    nextSequence++; 
     81                } 
     82                lastSequence.set( nextSequence - 1L ); 
     83            } 
     84        } else { 
     85            for ( long nextSequence = lastSequence.get() + 1L; 
     86                    nextSequence <= maxSequence; 
     87                    nextSequence++ ) { 
     88                lastSequenceBarrier.waitFor( nextSequence ); 
     89 
    7590                final LongValueMessage event = ringBuffer.get( nextSequence ); 
    7691                sum += event.value; 
    77                 nextSequence++; 
     92 
     93                lastSequence.set( nextSequence ); 
    7894            } 
    79             lastSequence.set( nextSequence - 1L ); 
    8095        } 
    8196 
  • Tests/JAVA/test/src/main/java/test/threads/queue/unstressed/impl/CABSESDMaskedUnrolledQueue.java

    r512 r533  
    2828 */ 
    2929public final class CABSESDMaskedUnrolledQueue<T> implements IQueue<T> { 
    30     private static final boolean USE_TEST_AND_SET = false; 
    31     private static final boolean USE_UNSAFE = true; 
     30    private static final boolean USE_TEST_AND_SET = true; 
     31    private static final boolean USE_UNSAFE = false; 
    3232 
    3333    private static final int PADDING_SIZE = 0;//bytes 
Note: See TracChangeset for help on using the changeset viewer.