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.

Since:
0.1.0
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    execute(Key worldName, ChunkPos pos, Runnable task)
    Schedules task to run as soon as possible on the region thread owning pos.
    void
    executeDelayed(Key worldName, ChunkPos pos, Runnable task, long delayTicks)
    Schedules task to run on the region thread owning pos, after at least delayTicks server ticks have elapsed.
    boolean
     
    List<? extends RegionTps>
    Takes a snapshot of the current per-region tick performance.
  • Method Details

    • execute

      void execute(Key worldName, ChunkPos pos, Runnable task)
      Schedules task to run as soon as possible on the region thread owning pos.
      Parameters:
      worldName - the key of the world the position belongs to
      pos - the chunk position identifying the target region
      task - the task to run
      Since:
      0.1.0
    • executeDelayed

      void executeDelayed(Key worldName, ChunkPos pos, Runnable task, long delayTicks)
      Schedules task to run on the region thread owning pos, after at least delayTicks server ticks have elapsed.
      Parameters:
      worldName - the key of the world the position belongs to
      pos - the chunk position identifying the target region
      task - the task to run
      delayTicks - the minimum number of ticks to wait before running the task
      Since:
      0.1.0
    • isOwnedByCurrentThread

      boolean isOwnedByCurrentThread(Key worldName, ChunkPos pos)
      Parameters:
      worldName - the key of the world the position belongs to
      pos - the chunk position identifying the target region
      Returns:
      true if the calling thread is the region thread that currently owns pos
      Since:
      0.1.0
    • tpsSnapshots

      List<? extends RegionTps> tpsSnapshots()
      Takes a snapshot of the current per-region tick performance.
      Returns:
      the tick performance of every currently active region, ordered by ascending TPS (worst-performing regions first)
      Since:
      0.1.0