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:
- Scheduler tick begins
- Pulse sessions
- run sync tasks, queue async tasks
- World tick for each world
- Run in-tick tasks
- await all worlds complete (in async task)
-
ClassesClassDescriptionA scheduler for managing server ticks, Bukkit tasks, and other synchronization.Represents a task which is executed periodically.Manager for world thread pool.