From: Burak K. <bbu...@gm...> - 2022-06-05 23:51:18
|
Dear all, Sorry for my often updates, I just tried the commit() function which leads me to incrementation of the belief mytask, but this time again I encounter the problem as follows: *java.lang.IllegalMonitorStateException at java.base/java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.signalAll(AbstractQueuedSynchronizer.java:1487) at cartago.Artifact.commitObsStateChanges(Artifact.java:551) at cartago.Artifact.commit(Artifact.java:629) at example_JaCaMo.MyTimer.save(MyTimer.java:66) at example_JaCaMo.MyTimer$1.run(MyTimer.java:42) at java.base/java.util.TimerThread.mainLoop(Timer.java:556) at java.base/java.util.TimerThread.run(Timer.java:506)* Thank you. Best regards. Burak Karaduman <bbu...@gm...>, 6 Haz 2022 Pzt, 01:40 tarihinde şunu yazdı: > Hi, > > I deleted the signal and decided to move on with belief addition. However, > it only updates the value from 0 to 1 once. I think as the operation still > goes on because of timerTask, it does not update the observable property. > In the book, I saw that commitObsState was proposed, but I haven't been > able to see any detailed example of usage. Also, I have only seen > commitChanges() in the version that I use. > > Best regards. > > Burak Karaduman <bbu...@gm...>, 6 Haz 2022 Pzt, 00:18 > tarihinde şunu yazdı: > >> Dear all, >> >> I am trying to create a timer that counts based on seconds. However, I am >> getting this error; >> >> >> >> >> >> >> >> >> *java.lang.IllegalMonitorStateException at >> java.base/java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.signalAll(AbstractQueuedSynchronizer.java:1487) >> at cartago.Artifact.commitObsStateChangesAndSignal(Artifact.java:573)at >> cartago.Artifact.signal(Artifact.java:637) at >> example_JaCaMo.MyTimer.access$000(MyTimer.java:11) at >> example_JaCaMo.MyTimer$1.run(MyTimer.java:29) at >> java.base/java.util.TimerThread.mainLoop(Timer.java:556) at >> java.base/java.util.TimerThread.run(Timer.java:506)* >> >> My code is simply like this: >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> *public class MyTimer extends Artifact { void init() { >> defineObsProperty("mytimer", 0); timer_creation(); } void timer_creation() >> { this.beginExternalSession(); Timer timer = new Timer(); TimerTask task >> = new TimerTask(){ private int i = 0; public void run(){ if (i >> <= 30) { signal("timerEnd"); System.out.println(i); >> } }}; timer.scheduleAtFixedRate(task, 0, 1000); //1000ms = 1sec >> this.endExternalSession(true); }}* >> >> How can I tackle this problem? >> >> Thank you. >> >> Best regards. >> >> >> >> -- >> >> *Burak KARADUMAN,* >> Ph.D. Student at the University of Antwerp & Flanders Make, >> Modeling Intelligent Complex Software & Systems (MICSS-Lab), >> *G236, Department of **Computer Science**, Faculty of Science, Campus >> Middelheim,* >> Middelheimlaan 1, 2020 Antwerp, Belgium >> >> > > -- > > *Burak KARADUMAN,* > Ph.D. Student at the University of Antwerp & Flanders Make, > Modeling Intelligent Complex Software & Systems (MICSS-Lab), > *G236, Department of **Computer Science**, Faculty of Science, Campus > Middelheim,* > Middelheimlaan 1, 2020 Antwerp, Belgium > > -- *Burak KARADUMAN,* Ph.D. Student at the University of Antwerp & Flanders Make, Modeling Intelligent Complex Software & Systems (MICSS-Lab), *G236, Department of **Computer Science**, Faculty of Science, Campus Middelheim,* Middelheimlaan 1, 2020 Antwerp, Belgium |