I am sorry for not being clear earlier. I believe my question is a Mason related one. More specifically I want to run an experiment that will be repeated 100 times (each iteration has some randomly generated parameters). One obvious way is to run an iteration and then manually start the program. However this is time consuming, hence I am trying to automate the runs.
In each iteration, there are multiple agents each modeled as thread in Mason. There is a display frame that gets created in each iteration which gets closed at the end of the iteration. In order to make it automated I am setting the display frame to null by using displayFrame.dispose() and then displayFrame = null after the run is completed so in the next iteration a new display frame comes up. However this is creating an issue since the old display frame was not getting killed. In order to make sure it gets killed correctly, I had to put in an arbitrary sleep so that all the threads are finished and then the frame is killed. However the sleep is leading to:
(a) Long run times (hours) once I set up more runs.
(b) As I am making the frame null, it is not freeing up the memory hence I get memory dump after some point. I also tried using unregisterFrame() and unregisterAllFrames() but none of these worked.
In short, I'm trying to find out,
(a)Is there a functionality in Mason that can detect when all the threads are done so we know when to close the display frame?
(b)Is there a way to close the display frame instead of specifically nullifying it?Thanks,RashiOn Mon, Oct 12, 2015 at 11:09 PM, Eric 'Siggy' Scott <[log in to unmask]> wrote:
How to wait for threads until they complete is a general Java question, not a Mason question. General multithreaded programming is out of the scope of this list.
Of course, perhaps I've misunderstood your question, and you are using something Mason-specific to control your threads. In that case perhaps you could give us a little more detail about what you're doing and what you'd like to do.
--On Mon, Oct 12, 2015 at 11:18 AM, Rashi Aswani <[log in to unmask]> wrote:Rashi AswaniHello,I'm using mason for a simulation having various threads and I'm trying to run the same simulation again with different parameter values. I'm currently using thread.sleep (to pause main thread) before creating one more simulation (in next iteration) so as provide enough time for existing simulation to run.
It would be great to know if there is any other way of handling threads, as the sleep increases runtime to a great extent.Thanking you in advance.Regards,Ph.D student in Computer Science, George Mason UniversityCFO and Web Director, Journal of Mason Graduate Research