Code example for CopyOnWriteArraySet

0
package net.md_5.bungee.api.plugin; 
 
import java.net.URL; 
import java.net.URLClassLoader; 
import java.util.Set; 
import java.util.concurrent.CopyOnWriteArraySet; 
 
public class PluginClassloader extends URLClassLoader
{ 
 
    private static final Set<PluginClassloader> allLoaders = new CopyOnWriteArraySet<>();
 
    static 
    { 
        ClassLoader.registerAsParallelCapable(); 
    } 
 
    public PluginClassloader(URL[] urls)
    { 
        super( urls );
        allLoaders.add( this );
    } 
 
    @Override 
    protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException
    {