Search in sources :

Example 1 with StopException

use of com.hazelcast.simulator.test.StopException in project hazelcast-simulator by hazelcast.

the class ProducerConsumerTest method consume.

@TimeStep(executionGroup = "consumer")
public void consume(ConsumerState state) throws Exception {
    Long item = workQueue.take();
    if (item.equals(-1L)) {
        workQueue.add(item);
        throw new StopException();
    }
    state.consumed++;
    Thread.sleep(state.randomInt(maxIntervalMillis));
}
Also used : IAtomicLong(com.hazelcast.core.IAtomicLong) StopException(com.hazelcast.simulator.test.StopException) TimeStep(com.hazelcast.simulator.test.annotations.TimeStep)

Aggregations

IAtomicLong (com.hazelcast.core.IAtomicLong)1 StopException (com.hazelcast.simulator.test.StopException)1 TimeStep (com.hazelcast.simulator.test.annotations.TimeStep)1