Cleaner version of removing project's directory
This commit is contained in:
@@ -35,6 +35,8 @@ import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Observable;
|
||||
import java.util.Observer;
|
||||
import java.util.TimeZone;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
@@ -70,14 +72,10 @@ public class Job {
|
||||
private boolean serverBlockJob;
|
||||
private Gui gui;
|
||||
private Configuration config;
|
||||
private Client client;
|
||||
private Log log;
|
||||
|
||||
private boolean directoryRemoved;
|
||||
|
||||
public Job(Configuration config_, Client client_, Gui gui_, Log log_, String id_, String frame_, String path_, boolean use_gpu, String command_, String script_, String sceneMd5_, String rendererMd5_, String name_, String password_, String extras_, boolean synchronous_upload_, String update_method_) {
|
||||
public Job(Configuration config_, Gui gui_, Log log_, String id_, String frame_, String path_, boolean use_gpu, String command_, String script_, String sceneMd5_, String rendererMd5_, String name_, String password_, String extras_, boolean synchronous_upload_, String update_method_) {
|
||||
config = config_;
|
||||
client = client_;
|
||||
id = id_;
|
||||
numFrame = frame_;
|
||||
path = path_;
|
||||
@@ -98,7 +96,6 @@ public class Job {
|
||||
serverBlockJob = false;
|
||||
log = log_;
|
||||
render = new RenderProcess();
|
||||
directoryRemoved = false;
|
||||
}
|
||||
|
||||
public void block() {
|
||||
@@ -230,7 +227,7 @@ public class Job {
|
||||
return synchronousUpload;
|
||||
}
|
||||
|
||||
public Error.Type render() {
|
||||
public Error.Type render(Observer renderStarted) {
|
||||
gui.status("Rendering");
|
||||
RenderProcess process = getProcessRender();
|
||||
Timer timerOfMaxRenderTime = null;
|
||||
@@ -326,6 +323,7 @@ public class Job {
|
||||
}
|
||||
|
||||
try {
|
||||
renderStartedObservable event = new renderStartedObservable(renderStarted);
|
||||
String line;
|
||||
log.debug(command.toString());
|
||||
OS os = OS.getOS();
|
||||
@@ -377,9 +375,8 @@ public class Job {
|
||||
return error;
|
||||
}
|
||||
|
||||
if (directoryRemoved == false && (process.getMemoryUsed() > 0 || process.getRemainingDuration() > 0)) {
|
||||
client.removeSceneDirectory(this);
|
||||
directoryRemoved = true;
|
||||
if (event.isStarted() == false && (process.getMemoryUsed() > 0 || process.getRemainingDuration() > 0)) {
|
||||
event.doNotifyIsStarted();
|
||||
}
|
||||
}
|
||||
input.close();
|
||||
@@ -859,4 +856,23 @@ public class Job {
|
||||
return config.getTileSize();
|
||||
}
|
||||
}
|
||||
|
||||
public static class renderStartedObservable extends Observable {
|
||||
private boolean isStarted;
|
||||
|
||||
public renderStartedObservable(Observer observer) {
|
||||
super();
|
||||
addObserver(observer);
|
||||
}
|
||||
|
||||
public void doNotifyIsStarted() {
|
||||
setChanged();
|
||||
notifyObservers();
|
||||
isStarted = true;
|
||||
}
|
||||
|
||||
public boolean isStarted() {
|
||||
return isStarted;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user