Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Information
This PR fixes n/a
Details
Currently, the plugin can take a long time to load depending on the size of the uuids.bin file.
Proposed fix:
Replace the set implementation used by the uuid cache with a concurrenthasthmap backed set.
Environments tested:
OS: Ubuntu 20.04
Java version: 17.0.1
Demonstration:
Before
Jstack
"Server thread" prio=7 os_prio=0 cpu=254434.36ms elapsed=256.38s tid=0x00007f33c4503e10 nid=0x37616e runnable [0x00007f33d81fa000] java.lang.Thread.State: RUNNABLE at java.util.concurrent.CopyOnWriteArrayList.indexOfRange(java.base@17.0.1/CopyOnWriteArrayList.java:193) at java.util.concurrent.CopyOnWriteArrayList.indexOf(java.base@17.0.1/CopyOnWriteArrayList.java:238) at java.util.concurrent.CopyOnWriteArrayList.contains(java.base@17.0.1/CopyOnWriteArrayList.java:230) at java.util.concurrent.CopyOnWriteArraySet.contains(java.base@17.0.1/CopyOnWriteArraySet.java:157) at com.earth2me.essentials.userstorage.ModernUUIDCache.loadCache(ModernUUIDCache.java:178) at com.earth2me.essentials.userstorage.ModernUUIDCache.(ModernUUIDCache.java:57) at com.earth2me.essentials.userstorage.ModernUserMap.(ModernUserMap.java:33) at com.earth2me.essentials.Essentials.onEnable(Essentials.java:313) at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264) at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:370) at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:542) - locked <0x000000070a8aada0> (a org.bukkit.plugin.SimplePluginManager) at org.bukkit.craftbukkit.v1_19_R1.CraftServer.enablePlugin(CraftServer.java:565) at org.bukkit.craftbukkit.v1_19_R1.CraftServer.enablePlugins(CraftServer.java:479)After