• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • Tim Cooke
  • Knute Snortum
  • Junilu Lacar
  • Devaka Cooray
Saloon Keepers:
  • Ganesh Patekar
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • salvin francis
  • Ron McLeod
  • Frits Walraven
  • Pete Letkeman

bulk syncing of data  RSS feed

Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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

Ranch Hand
Posts: 158
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!