In the world of programming, there are usually two types of ways to code Java: the optimized way and the way that gets the product into production before the deadline. However, with the right skill-set, a programmer can find ways and means to make every program fun faster and tighter despite even the most compressed time frames before completion. Variables, multimedia, image rendering and data retrieval are just some of the Java topics tackled in this comprehensive free download book. If you've ever wondered how to get the most out of every line of Java code you author, this is the free book is for you.
starting day
2011.01.24
Chapter 2 : Using the Media Tracker
in source code searching...
i just came upon such situation
public void run() { try { tracker.waitForID(0); } catch (InterruptedException e) { return; } repaint(); }
and as it says:
The run method is where the tracking actually starts taking place. The waitForID method of
MediaTracker is called within a try-catch clause. It must be placed in this exception handling
clause because an InterruptedException will be thrown if another thread interrupts this thread.
Recall that waitForID is synchronous , meaning that it won't return until all the images with the
specified identifier have been loaded. This means that the call to repaint will not occur until the
images have all been loaded.
you see, here why it calls the waitForID method is synchronous, no synchronous identifier was found attached before the method name according to the jdk1.6 javadoc...
so i think it just means it does not open another thread to do the work, so...it's synchronous, right!?
the related code will be put in another thread, see:
http://dracularking.iteye.com/blog/893957