updated thread handling:

- threads are no longer pooled (this makes naming threads difficult)
- threads are now named by their causing event, which improves logging

updated calls to thread.sleep: those are now provided by new class Delayed Execution
This commit is contained in:
Stephan Richter
2021-02-28 13:03:21 +01:00
parent cabab80b5c
commit b951b948e5
47 changed files with 293 additions and 260 deletions

View File

@@ -6,8 +6,8 @@ import java.util.Map;
import org.json.JSONObject;
import de.srsoftware.web4rail.Application;
import de.srsoftware.web4rail.BaseClass;
import de.srsoftware.web4rail.DelayedExecution;
import de.srsoftware.web4rail.tags.Fieldset;
import de.srsoftware.web4rail.tags.Label;
import de.srsoftware.web4rail.tags.Window;
@@ -24,7 +24,7 @@ public class SetDisplayText extends TextAction{
}
@Override
public boolean fire(Context context) {
public boolean fire(Context context,Object cause) {
plan.place(display.text(fill(text, context)));
return true;
}
@@ -44,14 +44,13 @@ public class SetDisplayText extends TextAction{
@Override
public Action load(JSONObject json) {
if (json.has(DISPLAY)) {
Application.threadPool.execute(new Thread() { // load asynchronously, as referred tile may not be available,yet
public void run() {
try {
sleep(1000);
display = (TextDisplay) plan.get(Id.from(json,DISPLAY), false);
} catch (InterruptedException e) {}
new DelayedExecution(this) {
@Override
public void execute() {
display = (TextDisplay) plan.get(Id.from(json,DISPLAY), false);
};
});
};
}
return super.load(json);
}