01-13-2010 06:15 PM - edited 01-13-2010 06:17 PM
Read the API documents, especially for RuntimeStore.waitFor. Once understood, then you can think about how to coordinate two threads in two different processes by using signalling with the RuntimeStore, and it should be fairly apparent. Using blocking and wait/notify properly with threads is much more advantageous to using threads and polling.
This is in some way complementary to what peter_strange is proposing -- using the PersistentStore doesn'treally get you anything than data that persists over a reboot.
01-13-2010 06:42 PM
The choice of Persistent Storage was just out of conveinience from my part since I used it for other purposes. I will check out Runtime and waitfor
01-13-2010 08:21 PM
In this sort of circumstrance where it is important that messages in the message q are sent, even if they are sent after a reboot,, I would retain them in PersistentStore.
01-14-2010 03:11 AM - edited 01-14-2010 03:34 AM
Its not neccessary for these replies to be retained over a reboot. The waitfor function seems to favor Runtime storage.
The only drawback is that I cannot control how long to wait. it iseems to be locked to MAX_WAIT_MILLIS (or 2 minutes)
01-14-2010 09:57 AM
Could not be simpler:
RuntimeStore containing just a String to return
Redirector_settings settings = new Redirector_settings();
RuntimeStore Rstore = RuntimeStore.getRuntimeStore();
CreateAlert(settings.Debug,"Sending command to Redirector: " + parm1);
returnValue = (String) Rstore.waitFor(settings.Runtime);
CreateAlert(settings.Debug,"Got answer from Redirector: " + returnValue);
And Redirector just sets the store after handling the request