J2ME:Sharing RMS between threads

T

timnels

I have a timer task that is getting GPS settings at a pre-defined
interval and storing them in RMS. I have another thread that will be
picking those entries up and pushing them up to a server on the
Internet. From what I have read accessing these without a
syncronization method is a no-no. What methods are people using to
syncronize access to RMS? Also, is there a simple way to re-use record
ID's so your RMS doesn't grow out of control?
Thanks.
 
J

jan V

I have a timer task that is getting GPS settings at a pre-defined
interval and storing them in RMS.

Thanks for clarifying what RMS is.
I have another thread that will be
picking those entries up and pushing them up to a server on the
Internet. From what I have read accessing these without a
syncronization method is a no-no. What methods are people using to
syncronize access to RMS?

If the RMS doesn't provide some locking, i.e. synchronization, service
itself, then you could use a plain Object to represent the RMS lock. As long
as both producer and consumer sides of your architecture would "go through"
(i.e. honour the lock semantics) the lock, then your records would never get
corrupted or read partially. Using a plain Object with Java's thread
snchronization support (wait/notify etc) is rather elementary...
Also, is there a simple way to re-use record
ID's so your RMS doesn't grow out of control?

Circular list? Pool of IDs? I've got no experience of the J2ME platform, so
maybe these suggestions are not feasible on such a restricted JVM.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top