Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Copyright (c) 2020, 2023 Oracle and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.helidon.config;
import java.lang.System.Logger.Level;
import java.time.Instant;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Consumer;
import java.util.function.Predicate;
import java.util.function.Supplier;
import io.helidon.config.spi.ChangeEventType;
import io.helidon.config.spi.ChangeWatcher;
import io.helidon.config.spi.OverrideSource;
import io.helidon.config.spi.OverrideSource.OverrideData;
import io.helidon.config.spi.PollableSource;
import io.helidon.config.spi.PollingStrategy;
import io.helidon.config.spi.WatchableSource;
class OverrideSourceRuntime {
private static final System.Logger LOGGER = System.getLogger(OverrideSourceRuntime.class.getName());
private final OverrideReloader reloader;
private final Runnable changesRunnable;
private final OverrideSource source;
// we only want to start change support if changes are supported by the source
private final boolean changesSupported;
// the data used by filter to retrieve override data
private final AtomicReference, String>>> lastData = new AtomicReference<>(List.of());
// reference to change listener (the change listening is started after construction of this class)
private final AtomicReference changeListener = new AtomicReference<>();
// set to true if changes started
private boolean changesStarted = false;
// set to true when the content is loaded (to start changes whether the registration for change is before or after load)
private boolean dataLoaded = false;
@SuppressWarnings("unchecked")
OverrideSourceRuntime(OverrideSource overrideSource) {
this.source = overrideSource;
// content source
AtomicReference