From 3c535f6336532c91af3b47b7f6b0d639c2ee2322 Mon Sep 17 00:00:00 2001 From: Giuseppe Baittiner Date: Tue, 19 Dec 2023 15:56:19 +0100 Subject: [PATCH] fix: sync bug --- .../sanita/fse2/ms/edsclient/service/impl/ConfigSRV.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/it/finanze/sanita/fse2/ms/edsclient/service/impl/ConfigSRV.java b/src/main/java/it/finanze/sanita/fse2/ms/edsclient/service/impl/ConfigSRV.java index 2478d73..6c311f4 100644 --- a/src/main/java/it/finanze/sanita/fse2/ms/edsclient/service/impl/ConfigSRV.java +++ b/src/main/java/it/finanze/sanita/fse2/ms/edsclient/service/impl/ConfigSRV.java @@ -51,7 +51,7 @@ public void postConstruct() { public Boolean isRemoveMetadataEnable() { long lastUpdate = props.get(PROPS_NAME_REMOVE_METADATA_ENABLE).getKey(); if (new Date().getTime() - lastUpdate >= DELTA_MS) { - synchronized(ConfigSRV.class) { + synchronized(Locks.REMOVE_METADATA_ENABLE) { if (new Date().getTime() - lastUpdate >= DELTA_MS) { refresh(PROPS_NAME_REMOVE_METADATA_ENABLE); } @@ -94,4 +94,8 @@ private void init() { integrity(); } + private static final class Locks { + public static final Object REMOVE_METADATA_ENABLE = new Object(); + } + }