use of com.oracle.truffle.polyglot.PolyglotLoggers.LoggerCache in project graal by oracle.
the class PolyglotEngineImpl method getOrCreateEngineLoggers.
Object getOrCreateEngineLoggers() {
Object res = engineLoggers;
if (res == null) {
synchronized (this.lock) {
res = engineLoggers;
if (res == null) {
LoggerCache loggerCache = PolyglotLoggers.LoggerCache.newEngineLoggerCache(this);
loggerCache.setOwner(this);
res = LANGUAGE.createEngineLoggers(loggerCache);
if (!logLevels.isEmpty()) {
EngineAccessor.LANGUAGE.configureLoggers(this, logLevels, res);
}
for (ContextWeakReference contextRef : contexts) {
PolyglotContextImpl context = contextRef.get();
if (context != null && !context.config.logLevels.isEmpty()) {
LANGUAGE.configureLoggers(context, context.config.logLevels, res);
}
}
engineLoggers = res;
}
}
}
return res;
}
use of com.oracle.truffle.polyglot.PolyglotLoggers.LoggerCache in project graal by oracle.
the class PolyglotEngineImpl method getEngineLogger.
TruffleLogger getEngineLogger() {
TruffleLogger result = this.engineLogger;
if (result == null) {
synchronized (this.lock) {
result = this.engineLogger;
if (result == null) {
result = this.engineLoggerSupplier.apply(OPTION_GROUP_ENGINE);
Object logger = EngineAccessor.LANGUAGE.getLoggerCache(result);
LoggerCache loggerCache = (LoggerCache) EngineAccessor.LANGUAGE.getLoggersSPI(logger);
loggerCache.setOwner(this);
if (!logLevels.isEmpty()) {
EngineAccessor.LANGUAGE.configureLoggers(this, logLevels, logger);
}
this.engineLogger = result;
}
}
}
return result;
}
Aggregations