Source:
<code>public void addSegments(Iterable<DataSegment> segments, final DataSegmentChangeCallback callback) { try(final BackgroundSegmentAnnouncer backgroundSegmentAnnouncer = new BackgroundSegmentAnnouncer(announcer, exec, config.getAnnounceIntervalMillis())) { backgroundSegmentAnnouncer.startAnnouncing(); final List<ListenableFuture<Boolean>> segmentLoading = Lists.newArrayList(); for (final DataSegment segment : segments) { segmentLoading.add( getLoadingExecutor().submit( new Callable<Boolean>() { @Override <START> public Boolean call() throws SegmentLoadingException <END> { try { log.info("Loading segment %s", segment.getIdentifier()); final boolean loaded = loadSegment(segment, callback); if (loaded) { try { backgroundSegmentAnnouncer.announceSegment(segment); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new SegmentLoadingException(e, "Loading Interrupted"); } } return loaded; } catch(SegmentLoadingException e) { log.error(e, "[%s] failed to load", segment.getIdentifier()); throw e; } } } ) ); } int failed = 0; for(ListenableFuture future : segmentLoading) { try { future.get(); } catch(InterruptedException e) { Thread.currentThread().interrupt(); throw new SegmentLoadingException(e, "Loading Interrupted"); } catch(ExecutionException e) { failed++; } } if(failed > 0) { throw new SegmentLoadingException("%,d errors seen while loading segments", failed); } backgroundSegmentAnnouncer.finishAnnouncing(); } catch (SegmentLoadingException e) { log.makeAlert(e, "Failed to load segments") .addData("segments", segments) .emit(); } finally { callback.execute(); } }</code><technical_language>This a Runnable return for anything</technical_language>

Target:
public void addSegments(Iterable<DataSegment> segments, final DataSegmentChangeCallback callback) { try(final BackgroundSegmentAnnouncer backgroundSegmentAnnouncer = new BackgroundSegmentAnnouncer(announcer, exec, config.getAnnounceIntervalMillis())) { backgroundSegmentAnnouncer.startAnnouncing(); final List<ListenableFuture> segmentLoading = Lists.newArrayList(); for (final DataSegment segment : segments) { segmentLoading.add( getLoadingExecutor().submit( new Callable<Void>() { @Override public Void call() throws SegmentLoadingException { try { log.info("Loading segment %s", segment.getIdentifier()); final boolean loaded = loadSegment(segment, callback); if (loaded) { try { backgroundSegmentAnnouncer.announceSegment(segment); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new SegmentLoadingException(e, "Loading Interrupted"); } } return null; } catch(SegmentLoadingException e) { log.error(e, "[%s] failed to load", segment.getIdentifier()); throw e; } } } ) ); } int failed = 0; for(ListenableFuture future : segmentLoading) { try { future.get(); } catch(InterruptedException e) { Thread.currentThread().interrupt(); throw new SegmentLoadingException(e, "Loading Interrupted"); } catch(ExecutionException e) { failed++; } } if(failed > 0) { throw new SegmentLoadingException("%,d errors seen while loading segments", failed); } backgroundSegmentAnnouncer.finishAnnouncing(); } catch (SegmentLoadingException e) { log.makeAlert(e, "Failed to load segments") .addData("segments", segments) .emit(); } finally { callback.execute(); } }