PaperMC/Bukkit-Patches/0004-Make-the-plugin-class-loader-thread-safe.patch
2013-01-25 11:35:20 +11:00

41 lines
1.7 KiB
Diff

From e713a9083b0802334d046915c9f1995326e8956c Mon Sep 17 00:00:00 2001
From: snowleo <schneeleo@gmail.com>
Date: Wed, 17 Oct 2012 22:30:45 +0200
Subject: [PATCH] Make the plugin class loader thread safe
---
src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
index 10fc26a..4dca063 100644
--- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
+++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
@@ -45,6 +45,7 @@ import org.bukkit.plugin.UnknownDependencyException;
import org.yaml.snakeyaml.error.YAMLException;
import com.google.common.collect.ImmutableList;
+import java.util.concurrent.ConcurrentHashMap;
/**
* Represents a Java plugin loader, allowing plugins in the form of .jar
@@ -61,14 +62,14 @@ public class JavaPluginLoader implements PluginLoader {
@Deprecated
protected final Pattern[] fileFilters = fileFilters0;
- private final Map<String, Class<?>> classes0 = new HashMap<String, Class<?>>();
+ private final Map<String, Class<?>> classes0 = new ConcurrentHashMap<String, Class<?>>();
/**
* @deprecated Internal field that wasn't intended to be exposed
*/
@Deprecated
protected final Map<String, Class<?>> classes = classes0;
- private final Map<String, PluginClassLoader> loaders0 = new LinkedHashMap<String, PluginClassLoader>();
+ private final Map<String, PluginClassLoader> loaders0 = new ConcurrentHashMap<String, PluginClassLoader>();
/**
* @deprecated Internal field that wasn't intended to be exposed
*/
--
1.8.1-rc2