02-22-2010 07:46 AM
I've a question regarding RuntimeStore.
The API documentation says it is "a central location for applications to share information". But does this mean that there are no cached instances of the objects stored there?
Integer i = new Integer(0); RuntimeStore.getInstance().put(ID, i); i.setValue(7); //On other module: Integer i = (Integer) RuntimeStore.getInstance().get(ID);
What will be the value of i? It is necesary to call replace after each modification of the object in order to be inmediately visible to other modules?
And if I have my own cached Integer, is that object refreshed when some other module alters it, withouth having to call getInstance().get(ID)?
Solved! Go to Solution.
02-22-2010 09:33 AM
"i" will be 7. RuntimeStore keeps references to the object so if you modify the reference, other applications will see the changes. replace would be to change the object, such as from Integer to Float. At least that is from my experence.
02-22-2010 10:26 AM
Agree with rcmaniac25 and just to add a little.
Each Application will get a reference to the Object, so they will all see the same Object, Thus updates will be seen by all. If you create a new Object and replace, then the Object is no longer shared. Everyone will have to get the reference from RuntimeStore again.