Quellcode durchsuchen

de-lombok debugFqdn

tags/v0.15.4
Jonathan Cobb vor 4 Jahren
Ursprung
Commit
e68e49e63f
1 geänderte Dateien mit 16 neuen und 7 gelöschten Zeilen
  1. +16
    -7
      bubble-server/src/main/java/bubble/ApiConstants.java

+ 16
- 7
bubble-server/src/main/java/bubble/ApiConstants.java Datei anzeigen

@@ -56,14 +56,23 @@ public class ApiConstants {

public static final ObjectMapper DB_JSON_MAPPER = COMPACT_MAPPER;

@Getter(lazy=true) private static final String debugFqdn = initDebugFqdn();
private static String initDebugFqdn() {
try {
return FileUtil.toString(HOME_DIR+"/debug_fqdn").trim();
} catch (Exception e) {
log.debug("initDebugFqdn: "+shortError(e));
return "~debug_fqdn_disabled~"; // will never match any fqdn
// for some reason @Getter(lazy=true) causes compilation problems when other classes try to call getter
// so we implement lombok lazy-getter logic manuall here
private static final AtomicReference<String> debugFqdn = new AtomicReference<>();
public static String getDebugFqdn () {
if (debugFqdn.get() == null) {
synchronized (debugFqdn) {
if (debugFqdn.get() == null) {
try {
debugFqdn.set(FileUtil.toString(HOME_DIR + "/debug_fqdn").trim());
} catch (Exception e) {
log.debug("initDebugFqdn: " + shortError(e));
debugFqdn.set("~debug_fqdn_disabled~"); // will never match any fqdn
}
}
}
}
return debugFqdn.get();
}

private static String initDefaultDomain() {


Laden…
Abbrechen
Speichern