public class TerrainCacheGroup extends Object
Constructor and Description |
---|
TerrainCacheGroup()
Initializes a new instance.
|
Modifier and Type | Method and Description |
---|---|
void |
addCache(TerrainCache cache)
Adds a cache to the group.
|
TerrainCacheTimeStamp |
getCurrentTimeStamp()
Gets a time stamp that can be used for relative ordering of accesses to caches
and regions within this cache group.
|
static TerrainCacheGroup |
getDefault()
Gets the default group.
|
long |
getMaximumSize()
Gets the maximum size, in bytes, of this cache group.
|
void |
requestRegionLoad(TerrainRegion region)
Requests that a region be loaded into cache.
|
void |
setMaximumSize(long value)
Sets the maximum size, in bytes, of this cache group.
|
void |
startCacheThread()
Starts the thread associate with this cache group.
|
void |
stopCacheThread()
Stops the thread associated with this cache group.
|
@Nonnull public static TerrainCacheGroup getDefault()
public final void startCacheThread()
TerrainCacheGroup
will start the thread automatically.public final void stopCacheThread()
IllegalStateException
- Thrown if attempting to stop a thread that is already stopping or stopped.public final long getMaximumSize()
The size of the TerrainCacheGroup
will not always be less than the MaximumSize
(get
/ set
).
Rather, when loading a new region, if the size is above the maximum size, old regions
will be unloaded until the size is below the maximum (or all regions are unloaded).
When the new region is then loaded, the size might go back up above the maximum.
ArgumentOutOfRangeException
- Thrown when the provided maximum size is less than zero.public final void setMaximumSize(long value)
The size of the TerrainCacheGroup
will not always be less than the MaximumSize
(get
/ set
).
Rather, when loading a new region, if the size is above the maximum size, old regions
will be unloaded until the size is below the maximum (or all regions are unloaded).
When the new region is then loaded, the size might go back up above the maximum.
ArgumentOutOfRangeException
- Thrown when the provided maximum size is less than zero.public final void addCache(@Nonnull TerrainCache cache)
cache
- The cache to add.ArgumentNullException
- Thrown when cache
is null
.@Nonnull public final TerrainCacheTimeStamp getCurrentTimeStamp()
public final void requestRegionLoad(TerrainRegion region)
region
- The region to load.IllegalStateException
- Thrown when this cache group is asked to load a region belonging to a different cache group.