9
0
mirror of https://github.com/VolmitSoftware/Iris.git synced 2025-12-28 03:29:06 +00:00
This commit is contained in:
cyberpwn
2021-08-25 06:32:54 -04:00
parent 19fa9390ff
commit 1524866432
5 changed files with 49 additions and 18 deletions

View File

@@ -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();