public void closeSourceToOutputStorages(ModuleChunk chunk, boolean testSources)
     throws IOException {
   final Map<String, SourceToOutputMapping> storageMap =
       testSources ? myTestSourceToOutputs : myProductionSourceToOutputs;
   synchronized (mySourceToOutputLock) {
     for (Module module : chunk.getModules()) {
       final String moduleName = module.getName().toLowerCase(Locale.US);
       final SourceToOutputMapping mapping = storageMap.remove(moduleName);
       if (mapping != null) {
         mapping.close();
       }
     }
   }
 }
 public void flush(boolean memoryCachesOnly) {
   myArtifactsBuildData.flush(memoryCachesOnly);
   synchronized (mySourceToOutputLock) {
     for (Map.Entry<String, SourceToOutputMapping> entry :
         myProductionSourceToOutputs.entrySet()) {
       final SourceToOutputMapping mapping = entry.getValue();
       mapping.flush(memoryCachesOnly);
     }
     for (Map.Entry<String, SourceToOutputMapping> entry : myTestSourceToOutputs.entrySet()) {
       final SourceToOutputMapping mapping = entry.getValue();
       mapping.flush(memoryCachesOnly);
     }
   }
   mySrcToFormMap.flush(memoryCachesOnly);
   final Mappings mappings = myMappings;
   if (mappings != null) {
     synchronized (mappings) {
       mappings.flush(memoryCachesOnly);
     }
   }
 }