com.aliyun.auth.credentials.utils.OneCallerBlocks Maven / Gradle / Ivy
The newest version!
package com.aliyun.auth.credentials.utils;
import java.util.concurrent.atomic.AtomicBoolean;
public class OneCallerBlocks implements RefreshCachedSupplier.PrefetchStrategy {
private final AtomicBoolean currentlyRefreshing = new AtomicBoolean(false);
@Override
public void prefetch(Runnable valueUpdater) {
if (currentlyRefreshing.compareAndSet(false, true)) {
try {
valueUpdater.run();
} finally {
currentlyRefreshing.set(false);
}
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy