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 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") {
|
val generateTemplates = tasks.register<Copy>("generateTemplates") {
|
||||||
inputs.properties(
|
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 {
|
"commit" to provider {
|
||||||
val res = runCatching { project.extensions.getByType<Grgit>().head().id }
|
val res = runCatching { project.extensions.getByType<Grgit>().head().id }
|
||||||
res.getOrDefault("")
|
res.getOrDefault("")
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ public class IrisData implements ExclusionStrategy, TypeAdapterFactory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void dereference() {
|
public static void dereference() {
|
||||||
dataLoaders.v().forEach(IrisData::cleanupEngine);
|
dataLoaders.values().forEach(IrisData::cleanupEngine);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int cacheSize() {
|
public static int cacheSize() {
|
||||||
|
|||||||
@@ -63,14 +63,20 @@ public class IrisContext {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void dereference() {
|
public static synchronized void dereference() {
|
||||||
for (Thread i : context.k()) {
|
var it = context.entrySet().iterator();
|
||||||
if (!i.isAlive() || context.get(i).engine.isClosed()) {
|
while (it.hasNext()) {
|
||||||
if (context.get(i).engine.isClosed()) {
|
var entry = it.next();
|
||||||
Iris.debug("Dereferenced Context<Engine> " + i.getName() + " " + i.threadId());
|
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