Use Java 7 API to make classloader thread safe. Closes #516

This commit is contained in:
md_5 2013-08-04 20:23:31 +10:00
parent ee8f33c196
commit 4463b0c1b2

View File

@ -2,13 +2,18 @@ package net.md_5.bungee.api.plugin;
import java.net.URL; import java.net.URL;
import java.net.URLClassLoader; import java.net.URLClassLoader;
import java.util.HashSet;
import java.util.Set; import java.util.Set;
import java.util.concurrent.CopyOnWriteArraySet;
public class PluginClassloader extends URLClassLoader public class PluginClassloader extends URLClassLoader
{ {
private static final Set<PluginClassloader> allLoaders = new HashSet<>(); private static final Set<PluginClassloader> allLoaders = new CopyOnWriteArraySet<>();
static
{
ClassLoader.registerAsParallelCapable();
}
public PluginClassloader(URL[] urls) public PluginClassloader(URL[] urls)
{ {