This commit is contained in:
cyberpwn committed 2021-08-25 06:32:54 -04:00
1 parent 19fa9390ff
commit 1524866432
5 files changed
+49 -18

No files matched your search

@@ -19,6 +19,7 @@
package com.volmit.iris.engine.data.cache;
import com.volmit.iris.Iris;
import com.volmit.iris.util.function.NastySupplier;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicReference;
@@ -50,6 +51,21 @@ public class AtomicCache<T> {
}
}
public T aquireNasty(NastySupplier<T> t)
{
return aquire(() -> {
try
{
return t.get();
}
catch(Throwable e)
{
return null;
}
});
}
public T aquire(Supplier<T> t) {
if (this.t.get() != null) {
return this.t.get();