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

@@ -7,9 +7,9 @@ import java.util.Map;
import org.json.JSONObject;
import de.srsoftware.tools.Tag;
import de.srsoftware.web4rail.Application;
import de.srsoftware.web4rail.BaseClass;
import de.srsoftware.web4rail.Connector;
import de.srsoftware.web4rail.DelayedExecution;
import de.srsoftware.web4rail.Route;
import de.srsoftware.web4rail.moving.Train;
import de.srsoftware.web4rail.tags.Fieldset;
@@ -52,17 +52,12 @@ public abstract class Bridge extends Tile {
@Override
public Tile load(JSONObject json) {
if (json.has(COUNTERPART)) {
Application.threadPool.execute(new Thread() {
new DelayedExecution(this) {
@Override
public void run() {
try {
sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
public void execute() {
counterpart = (Bridge) plan.get(Id.from(json, COUNTERPART), false);
}
});
};
}
return super.load(json);
}