use of com.tencent.polaris.configuration.api.core.ChangeType in project polaris-java by polarismesh.
the class DefaultConfigFile method onChange.
@Override
public void onChange(ConfigFileMetadata configFileMetadata, String newContent) {
String oldContent = this.content;
this.content = newContent;
ChangeType changeType = ChangeType.MODIFIED;
if (oldContent == null) {
changeType = ChangeType.ADDED;
}
if (newContent == null) {
changeType = ChangeType.DELETED;
}
if (Objects.equals(oldContent, newContent)) {
changeType = ChangeType.NOT_CHANGED;
}
if (objectCache != null) {
objectCache.invalidateAll();
cacheVersion.incrementAndGet();
}
fireChangeEvent(new ConfigFileChangeEvent(configFileMetadata, oldContent, newContent, changeType));
}
Aggregations