Removed Threading in ExecutionTimeSubject because of JavaFX Thread problem
This commit is contained in:
@ -566,6 +566,7 @@ public class Controller_Frontend extends PICComponent implements FrontendControl
|
||||
@Override
|
||||
public void initialize(PICComponentLocator locator) {
|
||||
super.initialize(locator);
|
||||
executionTime.registerObserver(this);
|
||||
this.picComponents = locator;
|
||||
System.out.println("Frontend");
|
||||
}
|
||||
|
||||
@ -174,6 +174,7 @@ public class EEPROM extends PICComponent implements EEPROMInterface, ExecutionTi
|
||||
@Override
|
||||
public void initialize(PICComponentLocator locator) {
|
||||
super.initialize(locator);
|
||||
executionTime.registerObserver(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -24,29 +24,8 @@ public abstract class ExecutionTimeSubject extends PICComponent implements PICCo
|
||||
}
|
||||
|
||||
protected void notifyObservers(){
|
||||
for (final ExecutionTimeObserver each : observers){
|
||||
notify(each);
|
||||
}
|
||||
}
|
||||
|
||||
protected void notify(final ExecutionTimeObserver observer) {
|
||||
createNotifierFor(observer).start();
|
||||
}
|
||||
|
||||
|
||||
protected Thread createNotifierFor(ExecutionTimeObserver observer) {
|
||||
return new Thread(){
|
||||
public void run(){
|
||||
try {
|
||||
observer.executionTimeChanged();
|
||||
} catch (Exception e){
|
||||
e.printStackTrace();
|
||||
ExecutionTimeSubject.this.observers.remove(observer);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
observers.forEach(o -> o.executionTimeChanged());
|
||||
}
|
||||
|
||||
public double getTotalExecutionTime(){
|
||||
throw new UnsupportedOperationException("No class implements ExecutionTimeSubject correctly!");
|
||||
|
||||
@ -67,6 +67,7 @@ public class Timer extends PICComponent implements TimerInterface, ExecutionTime
|
||||
@Override
|
||||
public void initialize(PICComponentLocator locator) {
|
||||
super.initialize(locator);
|
||||
executionTime.registerObserver(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user