aspose file tools*
The moose likes Java Micro Edition and the fly likes bulk syncing of data Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Mobile » Java Micro Edition
Bookmark "bulk syncing of data" Watch "bulk syncing of data" New topic
Author

bulk syncing of data

Suraj Revankar
Greenhorn

Joined: Jul 23, 2011
Posts: 6


Hi All

I am working on the j2me appln.The appln syncs data to the server depending on the dates which is selected and this data is saved in the rms files.

Currently my requirement is that, the application should syncs all the saved data on click of one command and also the data should be synced sequentially.

For ex : I am syncing the data of 18,19,20 and 21. Now I want that until and unless the server sends an acknowledgement for 18 th the 19th should not be uploaded.
By this I mean t5hat,19th thread should be kept on hold until and unless I receive the ack for 18 thread from server


thanks
Suraj
Walter Gabrielsen Iii
Ranch Hand

Joined: Apr 09, 2011
Posts: 158
There are several options I can think of:

You could wait for the threads to reach each other at the same point before proceeding to the network connection, checking their progress with some volatile booleans.

It sounds like a buffer might be useful, something to hold the data as it completes, perhaps a Hashtable or a custom wrapper object, so you can organize it.

There are sleep() and join() methods in the Thread class. These might help if you don't mind blocking a thread for a while or ending it. Otherwise, if you intend to continue using these threads afterwards, these Thread methods probably won't help.

You can declare a method synchronized to run a method one thread at a time, but this blocking is slow, or you could use a synchronized block, with a locking reference using a private object reference or perhaps the current object's lock (this keyword), within a method to atomically block just a small section of method which allows other threads to run between the lines before/after the non-synchronized calls.
 
Consider Paul's rocket mass heater.
 
subject: bulk syncing of data