• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Manager / worker / updated data

 
Ranch Hand
Posts: 139
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm trying to learn / understand concurrency threads.
I expect to have a GUI start a SwingWorker, and the SwingWorker manages a number of worker threads, and some data is updated periodically.
I would like the manager to start the workers, then have data appear, then have the data updated after a period.
When the data is updated, I would like to have the workers utilize the new data in a controlled manner.
Also, the manager should be able to interrupt the worker threads.
The following code has minimal synchronization, and I'm not sure it's in the correct places. How should the code be modified so that the workers are notified that the data is being updated, and also so that the workers transition to the new data in a controlled manner.


 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic