[SOLVED] syncrhronized methods
"If count is an instance of SynchronizedCounter, then making these methods synchronized has two effects:
First, it is not possible for two invocations of synchronized methods on the same object to interleave. When one thread is executing a synchronized method for an object, all other threads that invoke synchronized methods for the same object block (suspend execution) until the first thread is done with the object.
Second, when a synchronized method exits, it automatically establishes a happens-before relationship with any subsequent invocation of a synchronized method for the same object. This guarantees that changes to the state of the object are visible to all threads.
Note that constructors cannot be synchronized — using the synchronized keyword with a constructor is a syntax error. Synchronizing constructors doesn't make sense, because only the thread that creates an object should have access to it while it is being constructed." (1).
1. What exactly is a "happens before" relationship?
2. Is it necessary to use a condition.signal() or condition.signalAll() the other methods to wake up awaiting threads, or are other synchronized methods waiting upon the synchronized method queued automatically? Is this question at all relevant to synchronized methods?
1. Synchronized Methods (The Java™ Tutorials > Essential Classes > Concurrency)
2. Core Java Volume I Pg. 747 (761) ISBN: 978-0-13-235476-9.