- synchronized access to AssetManager ClassLoader list

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@8606 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
nor..67 13 years ago
parent c0695b0a3a
commit 23b4e2fcf0
  1. 14
      engine/src/core/com/jme3/export/SavableClassUtil.java
  2. 9
      engine/src/desktop/com/jme3/asset/DesktopAssetManager.java

@ -185,13 +185,15 @@ public class SavableClassUtil {
}
String newClassName = remapClass(className);
for (ClassLoader classLoader : loaders){
try {
return (Savable) classLoader.loadClass(newClassName).newInstance();
} catch (InstantiationException e) {
} catch (IllegalAccessException e) {
}
synchronized(loaders) {
for (ClassLoader classLoader : loaders){
try {
return (Savable) classLoader.loadClass(newClassName).newInstance();
} catch (InstantiationException e) {
} catch (IllegalAccessException e) {
}
}
}
return fromName(className);

@ -102,12 +102,15 @@ public class DesktopAssetManager implements AssetManager {
public void addClassLoader(ClassLoader loader){
if(classLoaders == null)
classLoaders = Collections.synchronizedList(new ArrayList<ClassLoader>());
classLoaders.add(loader);
synchronized(classLoaders) {
classLoaders.add(loader);
}
}
public void removeClassLoader(ClassLoader loader){
if(classLoaders != null)
classLoaders.remove(loader);
if(classLoaders != null) synchronized(classLoaders) {
classLoaders.remove(loader);
}
}
public List<ClassLoader> getClassLoaders(){

Loading…
Cancel
Save