com.azure.identity.implementation.SynchronizedAccessor Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-identity Show documentation
Show all versions of azure-identity Show documentation
This module contains client library for Microsoft Azure Identity.
The newest version!
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
package com.azure.identity.implementation;
import reactor.core.publisher.Mono;
import java.time.Duration;
import java.util.function.Supplier;
/**
* Synchronizes reactor threads accessing/instantiating a common value {@code T}.
*
* @param The value being instantiated / accessed.
*/
public class SynchronizedAccessor {
private Mono monoCache;
public SynchronizedAccessor(Supplier> supplier) {
monoCache = supplier.get().cache();
}
public SynchronizedAccessor(Supplier> supplier, Duration cacheTimeout) {
monoCache = supplier.get().cache(cacheTimeout);
}
/**
* Get the value from the configured supplier.
*
* @return the output {@code T}
*/
public Mono getValue() {
return monoCache;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy