import org.simantics.scl.compiler.top.SCLCompilerConfiguration;
import org.simantics.scl.compiler.top.ValueNotFound;
import org.simantics.scl.compiler.types.Types;
import org.simantics.scl.compiler.top.SCLCompilerConfiguration;
import org.simantics.scl.compiler.top.ValueNotFound;
import org.simantics.scl.compiler.types.Types;
private final ModuleRepository parentRepository;
private final ModuleSourceRepository sourceRepository;
private ConcurrentHashMap<String, ModuleEntry> moduleCache = new ConcurrentHashMap<String, ModuleEntry>();
private final ModuleRepository parentRepository;
private final ModuleSourceRepository sourceRepository;
private ConcurrentHashMap<String, ModuleEntry> moduleCache = new ConcurrentHashMap<String, ModuleEntry>();
private static void finishModuleCompilation(String moduleName) {
PENDING_MODULES.get().remove(moduleName);
}
private static void finishModuleCompilation(String moduleName) {
PENDING_MODULES.get().remove(moduleName);
}
ArrayList<UpdateListener> externalListeners = new ArrayList<UpdateListener>();
notifyAboutUpdate(externalListeners);
for(UpdateListener listener : externalListeners)
listener.notifyAboutUpdate();
}
ArrayList<UpdateListener> externalListeners = new ArrayList<UpdateListener>();
notifyAboutUpdate(externalListeners);
for(UpdateListener listener : externalListeners)
listener.notifyAboutUpdate();
}
- synchronized void notifyAboutUpdate(ArrayList<UpdateListener> externalListeners) {
- stopListening();
- if (listeners == null)
- return;
+ void notifyAboutUpdate(ArrayList<UpdateListener> externalListeners) {
+ THashSet<UpdateListener> listenersCopy;
+ synchronized(this) {
+ listenersCopy = listeners;
+ if (listenersCopy == null)
+ return;
+ listeners = null;
+ }
if(moduleCache.get(moduleName) == this) {
moduleCache.remove(moduleName);
if(SCLCompilerConfiguration.TRACE_MODULE_UPDATE) {
if(moduleCache.get(moduleName) == this) {
moduleCache.remove(moduleName);
if(SCLCompilerConfiguration.TRACE_MODULE_UPDATE) {
- System.out.println("Invalidate " + moduleName);
- for(UpdateListener l : listeners)
- System.out.println(" " + l);
+ LOGGER.info("Invalidate " + moduleName);
+ for(UpdateListener l : listenersCopy)
+ LOGGER.info(" " + l);
beginModuleCompilation(moduleName);
compilationResult = source.compileModule(ModuleRepository.this, this, advisor == null ? null : advisor.getOptions(moduleName));
finishModuleCompilation(moduleName);
beginModuleCompilation(moduleName);
compilationResult = source.compileModule(ModuleRepository.this, this, advisor == null ? null : advisor.getOptions(moduleName));
finishModuleCompilation(moduleName);
public RuntimeEnvironment createRuntimeEnvironment(
EnvironmentSpecification environmentSpecification,
ClassLoader parentClassLoader,
public RuntimeEnvironment createRuntimeEnvironment(
EnvironmentSpecification environmentSpecification,
ClassLoader parentClassLoader,
public Map<String, Module> getModules() {
Map<String, Module> result = new HashMap<>(moduleCache.size());
for (Map.Entry<String, ModuleEntry> entry : moduleCache.entrySet()) {
public Map<String, Module> getModules() {
Map<String, Module> result = new HashMap<>(moduleCache.size());
for (Map.Entry<String, ModuleEntry> entry : moduleCache.entrySet()) {