Changeset 520 for Tests


Ignore:
Timestamp:
03/30/12 20:37:03 (10 years ago)
Author:
BegemoT
Message:
 
File:
1 edited

Legend:

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

    r498 r520  
    5353        ); 
    5454 
    55         final SequenceBarrier barrier = ringBuffer.newBarrier(); 
    56  
    57         lastSequenceBarrier = barrier; 
     55        lastSequenceBarrier = ringBuffer.newBarrier(); 
    5856 
    5957        ringBuffer.setGatingSequences( lastSequence ); 
    6058 
    61         return new Enqueuer<LongValueMessage>( eventsInBatch(), eventFactory, ringBuffer ); 
     59        return new Enqueuer( eventsInBatch(), eventFactory, ringBuffer ); 
    6260    } 
    6361 
     
    107105    } 
    108106 
    109     private class Enqueuer<E> extends EventEnqueuer<E> { 
    110         private final RingBuffer<E> ringBuffer; 
     107    private class Enqueuer extends EventEnqueuer<LongValueMessage> { 
     108        private final RingBuffer<LongValueMessage> ringBuffer; 
    111109 
    112110        private Enqueuer( final int eventsInBatch, 
    113                           final EventFactory<E> factory, 
    114                           final RingBuffer<E> ringBuffer ) { 
     111                          final EventFactory<LongValueMessage> factory, 
     112                          final RingBuffer<LongValueMessage> ringBuffer ) { 
    115113            super( eventsInBatch, factory ); 
    116114            this.ringBuffer = ringBuffer; 
     
    119117        @Override 
    120118        protected void enqueueEventsBatch( final int eventsInBatch, 
    121                                            final EventFactory<E> factory ) throws Exception { 
     119                                           final EventFactory<LongValueMessage> factory ) throws Exception { 
    122120            if ( publishInBatch ) { 
    123121                final BatchDescriptor batch = ringBuffer.newBatchDescriptor( eventsInBatch ); 
     
    130128                for ( int i = 0; i < eventsInBatch; i++ ) { 
    131129                    final long nextSequence = ringBuffer.next(); 
    132                     ringBuffer.get( nextSequence ); 
     130                    final LongValueMessage event = ringBuffer.get( nextSequence ); 
     131                    event.value = nextSequence; 
    133132                    ringBuffer.publish( nextSequence ); 
    134133                } 
Note: See TracChangeset for help on using the changeset viewer.