HELP! * GREY=local LOCAL HTML version of Foils prepared July 10 1996

Foil 112 Synchronized Method and Blocks

From Basic Lectures on Java Language Applets Graphics Networking Trip to China and Icase Tutorial -- July 12-28 and June 10-13 96. by Geoffrey C. Fox * See also color IMAGE

Synchronized methods and blocks must acquire a lock before running
Code will therefore not run at the same time as other code that needs access to the same resource.
Each object has one lock associated with it and each class has exactly one lock
When invoked, a synchronized method waits until it can acquire the lock for the current instance (i.e., this); a static synchronized method waits to acquire the class lock
Lock is released when code is done executing
Locks are advisory
synchronized blocks specify the object on which to synchronize



Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu

If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.

Page produced by wwwfoil on Tue Feb 18 1997