Browse Source

Fixed a cache usage issue and a logging issue

master
Drew Short 11 years ago
parent
commit
5e0877dd4f
  1. 16
      src/main/java/com/sothr/imagetools/AppConfig.java
  2. 2
      src/main/scala/com/sothr/imagetools/Engine.scala

16
src/main/java/com/sothr/imagetools/AppConfig.java

@ -31,9 +31,9 @@ public class AppConfig {
public static void configureApp() {
//configSimpleLogging();
if (!configuredLogging) {
BasicConfigurator.configure();
configBasicLogging();
loadProperties();
BasicConfigurator.resetConfiguration();
resetBasicLogging();
} else {
loadProperties();
}
@ -41,6 +41,16 @@ public class AppConfig {
configCache();
}
public static void configBasicLogging() {
BasicConfigurator.configure();
logger = LoggerFactory.getLogger(AppConfig.class);
}
public static void resetBasicLogging() {
logger = null;
BasicConfigurator.resetConfiguration();
}
public static void configLogging(String location) {
//Logging Config
//remove previous configuration if it exists
@ -114,7 +124,7 @@ public class AppConfig {
PropertiesService.loadProperties(DEFAULTPROPERTIESFILE, null);
}
loadedProperties = true;
logger.info("Loaded properties");
logger.info("Loaded Properties");
}
}

2
src/main/scala/com/sothr/imagetools/Engine.scala

@ -23,7 +23,7 @@ class Engine() extends Logging{
debug(s"Found ${files.length} files that are images in directory: $directoryPath")
for (file <- files) {
if (imageCache.isKeyInCache(file.getAbsolutePath)) {
images += imageCache.get(file.getAbsolutePath).asInstanceOf[Image]
images += imageCache.get(file.getAbsolutePath).getObjectValue.asInstanceOf[Image]
} else {
val image = ImageService.getImage(file)
imageCache.put(new Element(file.getAbsolutePath, image))

Loading…
Cancel
Save