![JAR search and dependency download from the Maven repository](/logo.png)
de.tsl2.nano.historize.SVolatile Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of tsl2.nano.datastructure Show documentation
Show all versions of tsl2.nano.datastructure Show documentation
optimized implementations for trees, collections, arrays, historized input
The newest version!
package de.tsl2.nano.historize;
import java.util.function.Supplier;
/**
* use {@link Volatile} only the {@link Supplier} to eval new value on expiring.
*
* NOTE: the use of {@link #setHardResetOnExpiring(boolean)} and
* {@link #set(Object)} may result in unpredicted results!
*
* @author ts
*/
public class SVolatile extends Volatile {
private Supplier callbackNewValue;
public SVolatile(long period, Supplier callbackNewValue) {
super(period, null);
this.callbackNewValue = callbackNewValue;
}
@Override
public T get() {
return super.get(callbackNewValue);
}
@Override
public T get(Supplier newValueOnExpired) {
throw new UnsupportedOperationException("please call the get() method without parameter");
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy