org.apache.qpid.sustained
Class SustainedClientTestCase.SustainedRateAdapter

java.lang.Object
  extended by org.apache.qpid.sustained.SustainedClientTestCase.SustainedRateAdapter
All Implemented Interfaces:
Runnable, MessageListener
Enclosing class:
SustainedClientTestCase

 class SustainedClientTestCase.SustainedRateAdapter
extends Object
implements MessageListener, Runnable

This class is used here to adjust the _delay value which in turn is used to control the number of messages/second that are sent through the test system. By keeping a record of the messages recevied and the average time taken to process the batch size can be calculated and so the delay can be adjusted to maintain that rate. Given that delays of < 10ms can be rounded up the delay is only used between messages if the _delay > 10ms * no messages in the batch. Otherwise the delay is used at the end of the batch.


Field Summary
(package private)  int _numBatches
           
(package private)  int _skipUpdate
           
(package private)  Long _totalDuration
           
(package private)  Long _totalReceived
           
(package private)  CountDownLatch _warmup
           
(package private)  Map<String,Long> delays
           
 
Constructor Summary
SustainedClientTestCase.SustainedRateAdapter(SustainedClientTestCase client)
           
 
Method Summary
 void onMessage(Message message)
           
 void run()
           
 void sentMessage()
          Incrment the number of sent messages and then sleep, if required.
 void setClient(SustainedClientTestCase client)
           
 void stop()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_warmup

CountDownLatch _warmup

_numBatches

int _numBatches

delays

Map<String,Long> delays

_totalReceived

Long _totalReceived

_totalDuration

Long _totalDuration

_skipUpdate

int _skipUpdate
Constructor Detail

SustainedClientTestCase.SustainedRateAdapter

SustainedClientTestCase.SustainedRateAdapter(SustainedClientTestCase client)
Method Detail

onMessage

public void onMessage(Message message)
Specified by:
onMessage in interface MessageListener

run

public void run()
Specified by:
run in interface Runnable

stop

public void stop()

sentMessage

public void sentMessage()
Incrment the number of sent messages and then sleep, if required.


setClient

public void setClient(SustainedClientTestCase client)


Licensed to the Apache Software Foundation