}
// Find the start index. This is either the index after the last processed index, or - if the last processed
// index is not available in the queue - the first index in the queue.
if (events.containsKey(index)) {
index = (Long) events.nextKey(index);
}
else {
index = (Long) events.firstKey();
}