- Thread simulationThread = new Thread(() ->
- {
- // TODO find a better condition
- while (!ui.isDisposed())
- {
- // always execute to keep timeline from "hanging behind" for too long
- timeline.executeUpTo(System.currentTimeMillis(), System.currentTimeMillis() + 10);
- long sleepTime;
- if (timeline.hasNext())
- sleepTime = timeline.nextEventTime() - System.currentTimeMillis();
- else
- sleepTime = 10;
- try
- {
- if (sleepTime > 0)
- Thread.sleep(sleepTime);
- }
- catch (InterruptedException e)
- {
- } // it is normal execution flow to be interrupted
- }
- });
- simulationThread.start();
- timeline.addEventAddedListener(event ->
- {
- if (event.getTiming() <= System.currentTimeMillis())
- simulationThread.interrupt();
- });
+// Thread simulationThread = new Thread(() ->
+// {
+// // TODO find a better condition
+// while (!ui.isDisposed())
+// {
+// // always execute to keep timeline from "hanging behind" for too long
+// timeline.executeUpTo(System.currentTimeMillis(), System.currentTimeMillis() + 10);
+// long sleepTime;
+// if (timeline.hasNext())
+// sleepTime = timeline.nextEventTime() - System.currentTimeMillis();
+// else
+// sleepTime = 10;
+// try
+// {
+// if (sleepTime > 0)
+// Thread.sleep(sleepTime);
+// }
+// catch (InterruptedException e)
+// {
+// } // it is normal execution flow to be interrupted
+// }
+// });
+// simulationThread.start();
+// timeline.addEventAddedListener(event ->
+// {
+// if (event.getTiming() <= System.currentTimeMillis())
+// simulationThread.interrupt();
+// });