org.apache.qpid.sustained
Class SustainedClientTestCase.SustainedRateAdapter
java.lang.Object
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.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
_warmup
CountDownLatch _warmup
_numBatches
int _numBatches
delays
Map<String,Long> delays
_totalReceived
Long _totalReceived
_totalDuration
Long _totalDuration
_skipUpdate
int _skipUpdate
SustainedClientTestCase.SustainedRateAdapter
SustainedClientTestCase.SustainedRateAdapter(SustainedClientTestCase client)
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