Allow the preset loading system to function if there are no orc files.

This commit is contained in:
Kevin Ruland 2012-08-23 19:52:39 +00:00
parent de27df7c09
commit c34d934a55

View File

@ -73,7 +73,9 @@ public class ConcurrentComponentPresetDatabaseLoader {
loaderPool.awaitTermination(90, TimeUnit.SECONDS); loaderPool.awaitTermination(90, TimeUnit.SECONDS);
writerPool.shutdown(); writerPool.shutdown();
writerPool.awaitTermination(90, TimeUnit.SECONDS); writerPool.awaitTermination(90, TimeUnit.SECONDS);
iterator.close(); if ( iterator != null ) {
iterator.close();
}
long end = System.currentTimeMillis(); long end = System.currentTimeMillis();
log.debug("Time to load presets: " + (end-startTime) + "ms " + presetCount + " loaded from " + fileCount + " files"); log.debug("Time to load presets: " + (end-startTime) + "ms " + presetCount + " loaded from " + fileCount + " files");
} }
@ -88,18 +90,14 @@ public class ConcurrentComponentPresetDatabaseLoader {
iterator = DirectoryIterator.findDirectory(SYSTEM_PRESET_DIR, iterator = DirectoryIterator.findDirectory(SYSTEM_PRESET_DIR,
new SimpleFileFilter("", false, "orc")); new SimpleFileFilter("", false, "orc"));
if (iterator == null) { if (iterator != null) {
throw new IllegalStateException("Component preset directory " + SYSTEM_PRESET_DIR + while( iterator.hasNext() ) {
" not found, distribution built wrong"); Pair<String,InputStream> f = iterator.next();
FileLoader loader = new FileLoader( f.getV(), f.getU() );
loaderPool.execute(loader);
fileCount ++;
}
} }
while( iterator.hasNext() ) {
Pair<String,InputStream> f = iterator.next();
FileLoader loader = new FileLoader( f.getV(), f.getU() );
loaderPool.execute(loader);
fileCount ++;
}
latch.countDown(); latch.countDown();
} }
} }