Skip to content

Commit

Permalink
fix: sync locks
Browse files Browse the repository at this point in the history
  • Loading branch information
gb-cic committed Dec 19, 2023
1 parent 62d7925 commit 93cb9d7
Showing 1 changed file with 14 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public void postConstruct() {
public Boolean isRemoveEds() {
long lastUpdate = props.get(PROPS_NAME_REMOVE_EDS_ENABLE).getKey();
if (new Date().getTime() - lastUpdate >= DELTA_MS) {
synchronized(PROPS_NAME_REMOVE_EDS_ENABLE) {
synchronized(Locks.REMOVE_EDS_ENABLE) {
if (new Date().getTime() - lastUpdate >= DELTA_MS) {
refresh(PROPS_NAME_REMOVE_EDS_ENABLE);
}
Expand All @@ -65,7 +65,7 @@ public Boolean isRemoveEds() {
public Boolean isAuditEnable() {
long lastUpdate = props.get(PROPS_NAME_AUDIT_ENABLED).getKey();
if (new Date().getTime() - lastUpdate >= DELTA_MS) {
synchronized(PROPS_NAME_CONTROL_LOG_ENABLED) {
synchronized(Locks.AUDIT_ENABLED) {
if (new Date().getTime() - lastUpdate >= DELTA_MS) {
refresh(PROPS_NAME_AUDIT_ENABLED);
}
Expand All @@ -80,7 +80,7 @@ public Boolean isAuditEnable() {
public Boolean isControlLogPersistenceEnable() {
long lastUpdate = props.get(PROPS_NAME_CONTROL_LOG_ENABLED).getKey();
if (new Date().getTime() - lastUpdate >= DELTA_MS) {
synchronized(PROPS_NAME_CONTROL_LOG_ENABLED) {
synchronized(Locks.CONTROL_LOG_ENABLED) {
if (new Date().getTime() - lastUpdate >= DELTA_MS) {
refresh(PROPS_NAME_CONTROL_LOG_ENABLED);
}
Expand All @@ -95,7 +95,7 @@ public Boolean isControlLogPersistenceEnable() {
public Boolean isSubjectNotAllowed() {
long lastUpdate = props.get(PROPS_NAME_SUBJECT).getKey();
if (new Date().getTime() - lastUpdate >= DELTA_MS) {
synchronized (PROPS_NAME_SUBJECT) {
synchronized (Locks.SUBJECT_CLEANING) {
if (new Date().getTime() - lastUpdate >= DELTA_MS) {
refresh(PROPS_NAME_SUBJECT);
}
Expand All @@ -110,7 +110,7 @@ public Boolean isSubjectNotAllowed() {
public Boolean isCfOnIssuerNotAllowed() {
long lastUpdate = props.get(PROPS_NAME_ISSUER_CF).getKey();
if (new Date().getTime() - lastUpdate >= DELTA_MS) {
synchronized(PROPS_NAME_ISSUER_CF) {
synchronized(Locks.ISSUER_CF_CLEANING) {
if (new Date().getTime() - lastUpdate >= DELTA_MS) {
refresh(PROPS_NAME_ISSUER_CF);
}
Expand Down Expand Up @@ -156,4 +156,13 @@ private void init() {
}
integrity();
}

private static class Locks {
public static final Object REMOVE_EDS_ENABLE = new Object();
public static final Object CONTROL_LOG_ENABLED = new Object();
public static final Object AUDIT_ENABLED = new Object();
public static final Object ISSUER_CF_CLEANING = new Object();
public static final Object SUBJECT_CLEANING = new Object();
}

}

0 comments on commit 93cb9d7

Please sign in to comment.