Package net.glowstone.chunk
Class ChunkManager.ChunkLock
java.lang.Object
net.glowstone.chunk.ChunkManager.ChunkLock
- All Implemented Interfaces:
Iterable<GlowChunk.Key>
- Enclosing class:
- ChunkManager
A group of locks on chunks to prevent them from being unloaded while in use.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
acquire
(GlowChunk.Key key) Acquires a lock on the given chunk key, if it's not already held.void
clear()
Release all locks.iterator()
void
release
(GlowChunk.Key key) Releases a lock on the given chunk key, if it's not already held.toString()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
ChunkLock
-
-
Method Details
-
acquire
Acquires a lock on the given chunk key, if it's not already held.- Parameters:
key
- the key to lock
-
release
Releases a lock on the given chunk key, if it's not already held.- Parameters:
key
- the key to lock
-
clear
public void clear()Release all locks. -
toString
-
iterator
- Specified by:
iterator
in interfaceIterable<GlowChunk.Key>
-