ResourceReloadListener#reload
is not supposed to perform any reloading on its own. Instead, its goal is to return a CompletableFuture
which, when evaluated, is supposed to submit the actual reloading tasks to various Executor
s.
If you try cheating the system by putting code directly in reload
and returning some dummy CompletableFuture
that does nothing, the game hangs when reloading, because the future returned by Synchronizer#whenPrepared
never gets called.
Naming it something like createReloadTask
seems like a way to discourage this path and clarify that no reloading should be done directly in this method.
imo, ResourceReloadListener
should be renamed to ResourceReloader
as they are the ones actually performing the reload (compare to ResourceReloadHandler
). The reload
name is fine imo, or we can consider a consistent naming scheme for all CompletableFuture
related names.
After a look, we already have a resource reloader that monitors reload.
Now, I am a bit confused on what this should be named, or if it should be renamed or not.
Hmm, maybe ResourceReloader
-> SimpleResourceReload
, ResourceReloadListener
-> ResourceReloader
. Additionally, name ResourceReloadMonitor
to ResourceReload
and name the implementations correspondingly. ResourceReload
represents one single reload and is discarded immediately after, so this name actually sounds good.
Most helpful comment
imo,
ResourceReloadListener
should be renamed toResourceReloader
as they are the ones actually performing the reload (compare toResourceReloadHandler
). Thereload
name is fine imo, or we can consider a consistent naming scheme for allCompletableFuture
related names.