Skip to content

Commit

Permalink
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -30,8 +30,8 @@ public GlobalVariables(DynamicObject defaultValue) {
}

public Object getOrDefault(String key, Object defaultValue) {
final Object v;
return ((v = get(key)) != null) ? v : defaultValue;
final Object value = get(key);
return (value != null) ? value : defaultValue;
}

public Object get(String key) {
@@ -43,8 +43,8 @@ public GlobalVariableStorage getStorage(String key) {
final GlobalVariableStorage currentStorage = variables.get(key);
if (currentStorage == null) {
final GlobalVariableStorage newStorage = new GlobalVariableStorage(defaultValue);
final GlobalVariableStorage racyNewStorage = variables.putIfAbsent(key, newStorage);
return (racyNewStorage == null) ? newStorage : racyNewStorage;
final GlobalVariableStorage prevStorage = variables.putIfAbsent(key, newStorage);
return (prevStorage == null) ? newStorage : prevStorage;
} else {
return currentStorage;
}

0 comments on commit bc4b492

Please sign in to comment.