Plugins break when the intended behaviour is put into place, because for some reason they are all packaging the same classes, an inherently unsafe operation in the case that the classes are loaded at the same time by multiple classloaders - hence we are removing safety from the loaders for now until a correct solution can be put in place.
By: md_5 <md_5@live.com.au>
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user