I am using CloudSim and figured out that some events were not removed from FutureQueue at the first time they were treated. Analysing the code, I noticed that while CloudSim class where running runClockTick method, there were some moments that future.remove(first) and future.removeAll(toRemove) were not working propertly. Sometimes some events were not removed from the structure even when remove and removeAll methods return true.
So, I figured out that other developers already had have problems in remove elements from a SortedSet (which is the structure used in FutureQueue class). Is there any special condition for using SortedSet data structure in FutureQueue class?
In my case, I changed the structure from SortedSet to TreeSet and I am always removing the first event from FutureQueue through a poll() method that I implemented. It works for me.
Hi all,
I am using CloudSim and figured out that some events were not removed from FutureQueue at the first time they were treated. Analysing the code, I noticed that while CloudSim class where running
runClockTick
method, there were some moments thatfuture.remove(first)
andfuture.removeAll(toRemove)
were not working propertly. Sometimes some events were not removed from the structure even when remove and removeAll methods return true.So, I figured out that other developers already had have problems in remove elements from a SortedSet (which is the structure used in FutureQueue class). Is there any special condition for using SortedSet data structure in FutureQueue class?
In my case, I changed the structure from SortedSet to TreeSet and I am always removing the first event from FutureQueue through a
poll()
method that I implemented. It works for me.