MantisBT - JANA
View Issue Details
0000192JANABugpublic2012-01-31 23:392012-03-27 10:10
davidl 
davidl 
normalminoralways
resolvedfixed 
0000192: Cannot call JApplication::Run() multiple times
Mauri reported this in an e-mail on 1/29/2012. The e-mail is:

--------
Remember that issue I had with event processor?

Here's another issue (I suspect it's related)

if I have two running event processor running, the second one will not execute the "init" statement.

    EventProcessor *myProc = new EventProcessor(jsOpt);
    DiagnoseProcessor *diProc = new DiagnoseProcessor(jsOpt);

1 app.Run(diProc);
2 app.Run(myProc);

    delete myProc;
    delete diProc;


whatever roc I put to app.Run first on line 1 will execute. Anything on line two will not init, brun, etc.

Unless I'm doing something wrong, this looks like a bug?
--------
I have confirmed this behavior. One can avoid it by using two JApplication objects, but the code should still be modified to produce the expected behavior. This is (as he suspects) related to the problem he reported in an e-mail to me on 1/28/2012.

The problem stems from the init_called flag being set the first time JApplication::Init is called. The flag is checked upon entry to the Init method which is called from the Run method. This does many things, including creation of the event buffer thread and calling of the JEventProcessor::init() methods.
No tags attached.
Issue History
2012-01-31 23:39davidlNew Issue
2012-03-27 10:10davidlNote Added: 0000325
2012-03-27 10:10davidlStatusnew => resolved
2012-03-27 10:10davidlResolutionopen => fixed
2012-03-27 10:10davidlAssigned To => davidl

Notes
(0000325)
davidl   
2012-03-27 10:10   
I attempted a simple resetting of the init_called flag at the end of Fini so that Run (and therefore Init) could be called a second time. This did not work. There are numerous variables that would need to be reset for this to work.

The equivalent functionality of calling Run twice is obtained by just instantiating another JApplication after the first one is deleted. The code was modified to print an informative message when a second call to Init is made and then throw an exception. This change will appear in JANA 0.6.4