use of java.util.concurrent.atomic.AtomicIntegerFieldUpdater in project pulsar by yahoo.
the class PersistentDispatcherFailoverConsumerTest method getNextConsumer.
private Consumer getNextConsumer(PersistentDispatcherMultipleConsumers dispatcher) throws Exception {
Consumer consumer = dispatcher.getNextConsumer();
Field field = Consumer.class.getDeclaredField("MESSAGE_PERMITS_UPDATER");
field.setAccessible(true);
AtomicIntegerFieldUpdater<Consumer> messagePermits = (AtomicIntegerFieldUpdater) field.get(consumer);
messagePermits.decrementAndGet(consumer);
return consumer;
}
Aggregations