use static memory for settings by config params
This commit is contained in:
parent
39b8da629c
commit
0bd3e98253
2 changed files with 32 additions and 2 deletions
|
@ -29,12 +29,11 @@ import java.util.stream.Collectors;
|
|||
*/
|
||||
public class ConfigLoader {
|
||||
|
||||
private final Map<ConfigParams, Settings> map;
|
||||
private static final Map<ConfigParams, Settings> map = new HashMap<>();
|
||||
|
||||
private ConfigLogger logger;
|
||||
|
||||
private ConfigLoader() {
|
||||
this.map = new HashMap<>();
|
||||
}
|
||||
|
||||
private static class Holder {
|
||||
|
|
|
@ -9,6 +9,7 @@ import java.util.ArrayList;
|
|||
import java.util.Arrays;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
public class ConfigParams implements Comparable<ConfigParams> {
|
||||
|
||||
|
@ -129,6 +130,36 @@ public class ConfigParams implements Comparable<ConfigParams> {
|
|||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return toString().hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
ConfigParams that = (ConfigParams) o;
|
||||
return withSystemEnvironment == that.withSystemEnvironment &&
|
||||
withSystemProperties == that.withSystemProperties &&
|
||||
failIfEmpty == that.failIfEmpty &&
|
||||
includeAll == that.includeAll &&
|
||||
withStdin == that.withStdin &&
|
||||
withSystemPropertiesOverride == that.withSystemPropertiesOverride &&
|
||||
Objects.equals(classLoaders, that.classLoaders) &&
|
||||
Objects.equals(reader, that.reader) &&
|
||||
Objects.equals(jdbcLookups, that.jdbcLookups) &&
|
||||
Objects.equals(settings, that.settings) &&
|
||||
Objects.equals(args, that.args) &&
|
||||
Objects.equals(directoryName, that.directoryName) &&
|
||||
Objects.equals(fileNamesWithoutSuffix, that.fileNamesWithoutSuffix) &&
|
||||
Objects.equals(fileLocations, that.fileLocations);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(ConfigParams o) {
|
||||
return COMPARATOR.compare(this, o);
|
||||
|
|
Loading…
Reference in a new issue