This commit is contained in:
Daniel Mills committed 2021-08-10 06:06:39 -04:00
1 parent fc4377abaf
commit d0fb3dde66
2 files changed
+31 -12

No files matched your search

@@ -33,6 +33,7 @@ import java.util.function.Supplier;
public class HyperLock {
private final ConcurrentLinkedHashMap<Long, ReentrantLock> locks;
private final BiFunction<? super Long, ? super ReentrantLock, ? extends ReentrantLock> accessor;
private boolean enabled = true;
public HyperLock() {
this(1024, false);
@@ -120,10 +121,24 @@ public class HyperLock {
}
public void lock(int x, int z) {
if(!enabled)
{
return;
}
getLock(x, z).lock();
}
public void unlock(int x, int z) {
if(!enabled)
{
return;
}
getLock(x, z).unlock();
}
public void disable() {
enabled = false;
}
}