Allay icon indicating copy to clipboard operation
Allay copied to clipboard

proposal: add thread check for most of the not thread-safe methods

Open smartcmd opened this issue 10 months ago • 0 comments

Problem

Since Allay is designed to be multi-thread between different worlds, it may be normal for plugin developers who are lack for multi-thread programming knowledges access not thread-safe methods in wrong threads unexpectedly. We need a mechanism to ensure plugin developers calling these methods correctly (in right thread), and throw exception when the caller is not in correct thread.

Solution

This proposal proposes an idea. To be detailed, we put check to these methods, and when they are called, the checker will check if the caller is in correct thread. This solution is similar to what Spigot/Paper did.

However, adding these checks may result in performance reduction. Maybe we can find a better solution.

smartcmd avatar Feb 26 '25 07:02 smartcmd