PaperMC/paper-server
Aikar a13afc05a6 Improved Async Task Scheduler
The Craft Scheduler still uses the primary thread for task scheduling.
This results in the main thread still having to do work as part of the
dispatching of async tasks.

If plugins make use of lots of async tasks, such as particle emitters
that want to keep the logic off the main thread, the main thread still
receives quite a bit of load from processing all of these queued tasks.

Additionally, resizing and managing the pending entries for all of
these asynchronous tasks takes up time on the main thread too.

This commit replaces the implementation of the scheduler when working
with asynchronous tasks, by forwarding calls to the new scheduler.

The Async Scheduler uses a single thread executor for "management" tasks.
The Management Thread is responsible for all adding and dispatching of
scheduled tasks.

The mainThreadHeartbeat will send a heartbeat task to the management thread
with the currentTick value, so that it can find which tasks to execute.

Scheduling of an async tasks also dispatches a management task, ensuring
that any Queue resizing operation occurs off of the main thread.

The async queue uses a complete separate PriorityQueue, ensuring that resize
operations are decoupled from the sync tasks queue.
2018-03-16 22:59:43 -04:00
..
patches/sources Player.setPlayerProfile API 2018-03-18 12:29:48 -04:00
src Improved Async Task Scheduler 2018-03-16 22:59:43 -04:00
.gitignore Setup Gradle project 2020-12-10 20:54:19 -08:00
build.gradle.kts Expose server build information 2016-03-01 14:32:43 -06:00
LGPL.txt
LICENCE.txt