Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move timeout and progress reports to Simulation #1028

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

pjonsson
Copy link
Contributor

@pjonsson pjonsson commented Dec 29, 2022

This moves the code for handling timeouts
and progress reports from LogScriptEngine to Simulation.

@pjonsson pjonsson changed the title Simulation: add support for timeout Move timeout and progress reports to Simulation Dec 31, 2022
@pjonsson
Copy link
Contributor Author

@nfi Added the commit that migrates the progress report to this PR. It's the last set timeout that should get precedence. I'm not sure what decides the order.

@nfi
Copy link
Member

nfi commented Dec 31, 2022

I get an exception when I deactivate and then reactivate a simulation script:

java.lang.IllegalStateException: Event is already scheduled: org.contikios.cooja.Simulation$1@19eff8d7
	at org.contikios.cooja.EventQueue.addEvent(EventQueue.java:95)
	at org.contikios.cooja.Simulation.scheduleEvent(Simulation.java:534)
	at org.contikios.cooja.Simulation.lambda$setTimeout$1(Simulation.java:556)
	at org.contikios.cooja.Simulation.lambda$new$0(Simulation.java:212)
	at java.base/java.lang.Thread.run(Thread.java:833)

@pjonsson
Copy link
Contributor Author

Fixed in latest update.

@nfi
Copy link
Member

nfi commented Dec 31, 2022

If you run a simulation until timeout, and then reload the simulation, the new simulation will immediately timeout without running anything. Also, it is no longer possible to continue running a simulation after first timeout.

@pjonsson
Copy link
Contributor Author

Fixed.

Add a method that gets the time of the first
scheduled item in the queue.
This moves the code for handling timeouts
from LogScriptEngine to Simulation.
This removes the duplicate progress reports when
using multiple script engines.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants