void () { myLowMemoryWatcher.stop(); final CommonProcessors.FindFirstProcessor<Exception> exceptionProc = new CommonProcessors.FindFirstProcessor<Exception>() { @Override public boolean process(Exception e) { LOG.error(e); return super.process(e); } }; close(myFilePathEnumerator, exceptionProc); close(myNameEnumerator, exceptionProc); for (Iterator<Map.Entry<IndexId<?, ?>, InvertedIndex<?, ?, Input>>> iterator = myIndices.entrySet().iterator(); iterator.hasNext(); ) { Map.Entry<IndexId<?, ?>, InvertedIndex<?, ?, Input>> index = iterator.next(); close(index.getValue(), exceptionProc); iterator.remove(); } final Exception exception = exceptionProc.getFoundValue(); if (exception != null) { removeIndexFiles(myBuildDir, exception); if (myRebuildRequestCause == null) { throw new RuntimeException(exception); } return; } if (myRebuildRequestCause != null) { removeIndexFiles(myBuildDir, myRebuildRequestCause); } }