public int read(Collection<? super StreamEventOffset> events, int maxEvents,
long timeout, TimeUnit unit, ReadFilter readFilter) throws IOException, InterruptedException {
int eventsRead = 0;
Stopwatch stopwatch = new Stopwatch();
stopwatch.start();
while (eventsRead < maxEvents && !(emptySources.isEmpty() && eventSources.isEmpty())) {
if (!emptySources.isEmpty()) {
prepareEmptySources(readFilter);
}