AMQConsumer { public void setPrefetchSize(int prefetchSize) { this.prefetchSize = prefetchSize; this.currentWindow.set(prefetchSize); this.info.setPrefetchSize(prefetchSize); if (this.prefetchSize == 0) { messagePullHandler.compareAndSet(null, new MessagePullHandler()); } else { messagePullHandler.set(null); } if (this.prefetchSize > 0) { serverConsumer.promptDelivery(); } } AMQConsumer(AMQSession amqSession,
                      org.apache.activemq.command.ActiveMQDestination d,
                      ConsumerInfo info,
                      ScheduledExecutorService scheduledPool,
                      boolean internalAddress); void init(SlowConsumerDetectionListener slowConsumerDetectionListener, long nativeId); ConsumerId getId(); void acquireCredit(int n); int handleDeliver(MessageReference reference, ICoreMessage message, int deliveryCount); void handleDeliverNullDispatch(); void acknowledge(MessageAck ack); void browseFinished(); ConsumerInfo getInfo(); boolean hasCredits(); void processMessagePull(MessagePull messagePull); void removeConsumer(); boolean hasNotificationDestination(); org.apache.activemq.command.ActiveMQDestination getOpenwireDestination(); void setPrefetchSize(int prefetchSize); boolean updateDeliveryCountAfterCancel(MessageReference ref); boolean removeRolledback(MessageReference messageReference); void addRolledback(MessageReference messageReference);  }
@Test public void testCreditsUpdatingPrefetchSize() throws Exception { AMQConsumer consumer = getConsumer(0); consumer.setPrefetchSize(1); testCredits(consumer); }