This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Threads and Synchronization and the fly likes Communication between threads Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Threads and Synchronization
Bookmark "Communication between threads" Watch "Communication between threads" New topic
Author

Communication between threads

John Vorwald
Ranch Hand

Joined: Sep 26, 2010
Posts: 139
Hi,
Boy, I'm going to have a tough time asking this question, because I'm not sure what the problem is, or how to make a simple example.
I have a reasonably large program based on a model-view-controller construct, where the models, views, and controller are on different threads.
I have just recently gotten a computationally intensive portion of the code working with multiple treads using ExecutorCompletionService.
The computationally intensive routines are in the model portion, and during execution communicate progress to the controller / views / other models with a variable fControllers. So there are blocks of code like

I'm wondering, do I need to implement sychronization of fControllers? and how to do it?

John
John Vorwald
Ranch Hand

Joined: Sep 26, 2010
Posts: 139
Never mind with this question. I put in the synchronized block on fControllers, with no change in error. I need to dig deeper to understand the source / cause of the problem.
The code was running in test mode of the computationally intensive multithread potion, and now I've started to use the complete program again, and am getting errors in the view. Possibly I made some change that needs to be accounted for in the view...
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Communication between threads