Kill orphan Blender process after rendering

This commit is contained in:
Raimund58
2023-07-15 14:49:03 +00:00
committed by harlekin
parent 5723d20a6a
commit 99a7020a2f
4 changed files with 21 additions and 7 deletions

View File

@@ -19,6 +19,7 @@
package com.sheepit.client;
import com.sheepit.client.os.OS;
import lombok.Data;
import java.util.Date;
@@ -92,7 +93,19 @@ import oshi.software.os.OSProcess;
return 0;
}
public void kill() {
if (process != null){
try {
OS.getOS().kill(process);
log.debug("RenderProcess::Process killed");
} catch (NullPointerException ex) { // We are racing the system itself, we can't avoid catching NPE's
log.debug("RenderProcess::Handled process becoming unavailable before getting killed");
}
}
}
public void finish() {
kill();
endTime = new Date().getTime();
osProcess = null;
process = null;