JDK5 and later extends the semantics for volatile so that the system will not allow a write of a volatile to be reordered with respect to any previous read or write, and a read of a volatile cannot be reordered with respect to any following read or write
Since Test class is being added dynamically to ByValue class and Test is a static field in the ByValue, is it possible that when one Thread RESET this static Test field the other thread sees a NULL value?
Sandra Wilson wrote:Hi, so what has fixed it finally? Am looking for a solution to the same scenario. Posting the solution here would be of great help.
Jeff Verdegan wrote:
Actually, the Future is tied to your tasks, not to the threads that execute them. And I would argue that for this reason, it's probably a more appropriate approach than the other one suggested earlier.
@OP: If you're using a thread pool in the first place, it means you have deliberately chosen to separate your tasks from the threads that execute them, and it seems more likely that you would care about when those tasks are done, rather than caring about the threads. If you really do want to know when the threads are all done, it seems simpler to just manage the threads yourself, and call their join() methods.
samir ware wrote:Hello Ranchers
Though is there any way by which I will get to know that now all the threads are done with the working and all of them came back in to the thread pool . I need to catch this event as I want to perform some operation when threads gets done with their processing .