Source:
public UpdateProgress equivalateSchedule(LocalDate start, LocalDate end) { UpdateProgress progress = UpdateProgress.START; for (Publisher publisher : publishers) { for (Channel channel : channelsSupplier.get()) { if (!shouldContinue()) { return progress; } Schedule schedule = scheduleResolver.unmergedSchedule( start.toDateTimeAtStartOfDay(), end.toDateTimeAtStartOfDay(), ImmutableList.of(channel), ImmutableList.of(publisher)); Iterator<ScheduleChannel> channelItr = schedule.scheduleChannels().iterator(); if (!channelItr.hasNext()) { throw new RuntimeException(String.format( "No schedule channel in schedule for %s, channel %s, from %s to %s", publisher.name(), channel.getTitle(), start.toString(), end.toString() )); } ScheduleChannel scheduleChannel = channelItr.next(); OwlTelescopeReporter telescopeProxy = OwlTelescopeReporter.create( OwlTelescopeReporters.CHANNEL_SCHEDULE_EQUIVALENCE, Event.Type.EQUIVALENCE ); telescopeProxy.startReporting(); Iterator<Item> channelItems = scheduleChannel.items().iterator(); while (channelItems.hasNext() && shouldContinue()) { Item scheduleItem = channelItems.next(); ResolvedContent resolvedContent = contentResolver.findByCanonicalUris( ImmutableSet.of(scheduleItem.getCanonicalUri())); Maybe<Identified> identified = resolvedContent.get(scheduleItem.getCanonicalUri()); if (identified.hasValue()) { Item value = (Item) identified.requireValue(); progress = progress.reduce(process(value, telescopeProxy)); reportStatus(generateStatus(start, end, progress, publisher, scheduleItem, channel)); } } telescopeProxy.endReporting(); } } return progress; }

Target:
public UpdateProgress equivalateSchedule(LocalDate start, LocalDate end) { UpdateProgress progress = UpdateProgress.START; OwlTelescopeReporter telescope = OwlTelescopeReporter.create( OwlTelescopeReporters.CHANNEL_SCHEDULE_EQUIVALENCE, Event.Type.EQUIVALENCE ); telescope.startReporting(); for (Publisher publisher : publishers) { for (Channel channel : channelsSupplier.get()) { if (!shouldContinue()) { return progress; } Schedule schedule = scheduleResolver.unmergedSchedule( start.toDateTimeAtStartOfDay(), end.toDateTimeAtStartOfDay(), ImmutableList.of(channel), ImmutableList.of(publisher)); Iterator<ScheduleChannel> channelItr = schedule.scheduleChannels().iterator(); if (!channelItr.hasNext()) { throw new RuntimeException(String.format( "No schedule channel in schedule for %s, channel %s, from %s to %s", publisher.name(), channel.getTitle(), start.toString(), end.toString() )); } ScheduleChannel scheduleChannel = channelItr.next(); Iterator<Item> channelItems = scheduleChannel.items().iterator(); while (channelItems.hasNext() && shouldContinue()) { Item scheduleItem = channelItems.next(); ResolvedContent resolvedContent = contentResolver.findByCanonicalUris( ImmutableSet.of(scheduleItem.getCanonicalUri())); Maybe<Identified> identified = resolvedContent.get(scheduleItem.getCanonicalUri()); if (identified.hasValue()) { Item value = (Item) identified.requireValue(); progress = progress.reduce(process(value, telescope)); reportStatus(generateStatus(start, end, progress, publisher, scheduleItem, channel)); } } } } telescope.endReporting(); return progress; }