• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java

 
atul gupta
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How could a MediaTracker object inform multiple threads that file downloads are complete?
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Extend thread, add a new static boolean to tell all the threads that file loading is done. Once the MediaTracker is done loading all the files, have it set the static boolean of the new thread class.



Now, just have all the threads that are interested in the MediaTracker extend FileThread... in their run() methods you can have them check on the filesDone boolean in a loop or something... in your other code, right after the MediaTracker has finished loading all the files, say FileThread.filesDone = true; and all the FileThreads will get updated...

Hope this helps,
-Nate
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic