Interface RegionizedScheduler
public interface RegionizedScheduler
Schedules tasks to run on the region thread that owns a given world position.
The server world is split into independently-ticked regions, each owned by a single worker
thread. Tasks submitted through this scheduler run on whichever thread currently owns the
targeted (worldName, pos), rather than on the calling thread.
Region threads must never block. Long work belongs on an executor of your own, whose
result is then handed back to the right region with execute(Key, ChunkPos, Runnable).
- Since:
- 0.1.0
-
Method Summary
Modifier and TypeMethodDescriptionbooleanSchedulestaskto run as soon as possible on the region thread owningpos.booleanexecuteDelayed(Key worldName, ChunkPos pos, Runnable task, long delayTicks) Schedulestaskto run on the region thread owningpos, after at leastdelayTicksserver ticks have elapsed.booleanisOwnedByCurrentThread(Key worldName, ChunkPos pos) Checks whether the calling thread may safely touch the given position.Takes a snapshot of the current per-region tick performance.
-
Method Details
-
execute
Schedulestaskto run as soon as possible on the region thread owningpos.- Parameters:
worldName- the key of the world the position belongs topos- the chunk position identifying the target regiontask- the task to run- Returns:
falseif the task failed to be scheduled- Since:
- 0.1.0
-
executeDelayed
Schedulestaskto run on the region thread owningpos, after at leastdelayTicksserver ticks have elapsed.- Parameters:
worldName- the key of the world the position belongs topos- the chunk position identifying the target regiontask- the task to rundelayTicks- the minimum number of ticks to wait before running the task- Returns:
falseif the task failed to be scheduled- Since:
- 0.1.0
-
isOwnedByCurrentThread
Checks whether the calling thread may safely touch the given position.- Parameters:
worldName- the key of the world the position belongs topos- the chunk position identifying the target region- Returns:
trueif the calling thread is the region thread that currently ownspos- Since:
- 0.1.0
-
tpsSnapshots
-