我正在使用 Chronicle Queue v4.5.15。我创建了一个方法来告诉我队列中的元素数量:
public long getQueueSize() {
long index = getQueueIndex(); // I store the index in a persistent map so this method simply retrieves the current index from the map.
ExcerptTailer tailer = queue.createTailer();
long lastIndex = tailer.toEnd().index(); // Get the last index in our queue.
long count = queue.countExcerpts(queueIndex, lastIndex);
return count
}
我在一夜之间进行了测试,我的组件有一个为 12 月 22 日编写的 cq4 队列文件。它是一个每日周期。我今天尝试将一些元素添加到队列中,但抛出了异常'IllegalStateException: 'file not found' for the upperCycle, file ../path_to_queue/20161314.cq4
。
堆栈跟踪:
Caused by java.lang.IllegalStateException: java.lang.IllegalStateException: 'file not found' for the upperCycle, file=/var/tmp/app/20161224.cq4
at net.openhft.chronicle.queue.impl.single.SingleChronicleQueue.countExcertps(SingleChronicleQueue.java:359(
at ...
今天是12月23日,Chronicle为什么还要找档案呢?
这可能与我获得最后一个索引的方式有关吗?
谢谢