Welcome!

Welcome to the Official BlackBerry Support Community Forums. This is your resource to discuss support topics with your peers, and learn from each other. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Java Development

Reply
Developer
darkberry
Posts: 178
Registered: ‎11-19-2008
Accepted Solution

Question about RuntimeStore

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?

For example:

 

 

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)?

 

Thanks.

Please use plain text.
Developer
rcmaniac25
Posts: 1,789
Registered: ‎04-28-2009
My Carrier: Verizon

Re: Question about RuntimeStore

"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.

------------------------------------------------------------
Three simple rules:
1. Please use the search bar before making new posts.
2. Kudo posts that you find helpful.
3. If a solution has been found for your post, mark it as solved.
--I code too much. Well, too bad.

Projects:
Bing 4 BlackBerry: http://bbing.codeplex.com/
PDF Renderer 4 BlackBerry: http://pdfrend4bb.codeplex.com/
Please use plain text.
Developer
peter_strange
Posts: 17,632
Registered: ‎07-14-2008

Re: Question about RuntimeStore

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.

Please use plain text.
Developer
darkberry
Posts: 178
Registered: ‎11-19-2008

Re: Question about RuntimeStore

I see. So RuntimeStore must be something like a shared area of RAM.

Thanks, peter and rcmaniac25.

Please use plain text.