-
Notifications
You must be signed in to change notification settings - Fork 56
Use limited number of threads #120
Copy link
Copy link
Open
Labels
Milestone
Description
NoteBlockAPI 1.x uses one platform thread for each SongPlayer even when the playback has not started yet. It is not very resource effective so a different solution should be used.
@Elecast2 proposed a solution with a single-threaded ticker in PR #119. However, this solution use fixed 10ms delay which in some cases may not be precise enough and in other situations it does unnecessary work. Also it serialize SongPlayers into a queue and so e.g. an event in one of the SongPlayers may delay playback of the others.
I like the idea of the SongTicker or custom ExecutorService, but it has to be done in a way that one SongPlayer doesn't affect the others. Something like a group of worker threads and a PriorityQueue.
Reactions are currently unavailable