aboutsummaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorReinier Zwitserloot <reinier@zwitserloot.com>2014-01-20 01:44:53 +0100
committerReinier Zwitserloot <reinier@zwitserloot.com>2014-01-20 01:46:01 +0100
commite5dc6203c8dd2ac51594c8dd73945bb62c7fe047 (patch)
tree0085d51d9467c5e5257970e3f12eadaef417eb68 /src/core
parent8a1e0d03ae96b529daa26df188cb8779ea22c997 (diff)
downloadlombok-e5dc6203c8dd2ac51594c8dd73945bb62c7fe047.tar.gz
lombok-e5dc6203c8dd2ac51594c8dd73945bb62c7fe047.tar.bz2
lombok-e5dc6203c8dd2ac51594c8dd73945bb62c7fe047.zip
[configuration] ConfigurationKeysLoader now caches.
Diffstat (limited to 'src/core')
-rw-r--r--src/core/lombok/core/configuration/ConfigurationKeysLoader.java7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/core/lombok/core/configuration/ConfigurationKeysLoader.java b/src/core/lombok/core/configuration/ConfigurationKeysLoader.java
index 7fdbb4da..4e6e4fb1 100644
--- a/src/core/lombok/core/configuration/ConfigurationKeysLoader.java
+++ b/src/core/lombok/core/configuration/ConfigurationKeysLoader.java
@@ -23,18 +23,23 @@ package lombok.core.configuration;
import java.io.IOException;
import java.util.Iterator;
+import java.util.concurrent.atomic.AtomicBoolean;
import lombok.ConfigurationKeys;
import lombok.core.SpiLoadUtil;
public interface ConfigurationKeysLoader {
public class LoaderLoader {
+ private static final AtomicBoolean alreadyLoaded = new AtomicBoolean(false);
private LoaderLoader() {}
public static void loadAllConfigurationKeys() {
+ if (alreadyLoaded.get()) return;
+
try {
Class.forName(ConfigurationKeys.class.getName());
} catch (Throwable ignore) {}
+
try {
Iterator<ConfigurationKeysLoader> iterator = SpiLoadUtil.findServices(ConfigurationKeysLoader.class, ConfigurationKeysLoader.class.getClassLoader()).iterator();
while (iterator.hasNext()) {
@@ -44,6 +49,8 @@ public interface ConfigurationKeysLoader {
}
} catch (IOException e) {
throw new RuntimeException("Can't load config keys; services file issue.", e);
+ } finally {
+ alreadyLoaded.set(true);
}
}
}