Package net.glowstone.scheduler


package net.glowstone.scheduler
This package contains the core of Glowstone's threading model.

Glowstone has 4 groups of threads:

  • World threads. One thread per world
  • Event/scheduler thread. This thread contains all interaction with Bukkit API and synchronizes all other threads.
  • Async task thread pool. Pool of threads used to execute async tasks
  • Netty thread pool. This thread pool is used by Netty for network read/write

Whenever a thread wishes to call an event or perform other interactions with Bukkit API, it calls the GlowScheduler.syncIfNeeded(java.util.concurrent.Callable).

The scheduler thread synchronizes the world threads, so that each world thread begins a tick at the beginning of a scheduler pulse.

Operation order:

  1. Scheduler tick begins
  2. Pulse sessions
  3. run sync tasks, queue async tasks
  4. World tick for each world
  5. Run in-tick tasks
  6. await all worlds complete (in async task)
  • Classes
    Class
    Description
    A scheduler for managing server ticks, Bukkit tasks, and other synchronization.
    Represents a task which is executed periodically.
     
    Manager for world thread pool.