mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-02-16 02:20:44 +00:00
make context dereference method fail-safe
This commit is contained in:
@@ -182,10 +182,14 @@ tasks {
|
||||
}
|
||||
|
||||
val templateSource = file("src/main/templates")
|
||||
val templateDest = layout.buildDirectory.dir("generated/sources/templates")
|
||||
val templateDest = layout.buildDirectory.dir("generated/sources/templates")!!
|
||||
val generateTemplates = tasks.register<Copy>("generateTemplates") {
|
||||
inputs.properties(
|
||||
"environment" to if (project.hasProperty("release")) "production" else "development",
|
||||
"environment" to when {
|
||||
project.hasProperty("release") -> "producction"
|
||||
project.hasProperty("argghh") -> "Argghh!"
|
||||
else -> "development"
|
||||
},
|
||||
"commit" to provider {
|
||||
val res = runCatching { project.extensions.getByType<Grgit>().head().id }
|
||||
res.getOrDefault("")
|
||||
|
||||
@@ -103,7 +103,7 @@ public class IrisData implements ExclusionStrategy, TypeAdapterFactory {
|
||||
}
|
||||
|
||||
public static void dereference() {
|
||||
dataLoaders.v().forEach(IrisData::cleanupEngine);
|
||||
dataLoaders.values().forEach(IrisData::cleanupEngine);
|
||||
}
|
||||
|
||||
public static int cacheSize() {
|
||||
|
||||
@@ -63,14 +63,20 @@ public class IrisContext {
|
||||
}
|
||||
}
|
||||
|
||||
public static void dereference() {
|
||||
for (Thread i : context.k()) {
|
||||
if (!i.isAlive() || context.get(i).engine.isClosed()) {
|
||||
if (context.get(i).engine.isClosed()) {
|
||||
Iris.debug("Dereferenced Context<Engine> " + i.getName() + " " + i.threadId());
|
||||
}
|
||||
public static synchronized void dereference() {
|
||||
var it = context.entrySet().iterator();
|
||||
while (it.hasNext()) {
|
||||
var entry = it.next();
|
||||
var thread = entry.getKey();
|
||||
var context = entry.getValue();
|
||||
if (thread == null || context == null) {
|
||||
it.remove();
|
||||
continue;
|
||||
}
|
||||
|
||||
context.remove(i);
|
||||
if (!thread.isAlive() || context.engine.isClosed()) {
|
||||
Iris.debug("Dereferenced Context<Engine> " + thread.getName() + " " + thread.threadId());
|
||||
it.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user