samples/individualsamples/src/org/apidesign/samples/Synchronization.java
author Jaroslav Tulach <jaroslav.tulach@apidesign.org>
Thu, 30 Oct 2014 20:46:27 +0100
changeset 408 9a439a79c6d0
permissions -rw-r--r--
Use scala 2.10.4 to compile on JDK8
jtulach@144
     1
package org.apidesign.samples;
jtulach@144
     2
jtulach@144
     3
public class Synchronization {
jtulach@144
     4
    private final Object anObject = new Object();
jtulach@144
     5
    
jtulach@144
     6
    public void methodUsingSynchronizedBlock() {
jtulach@144
     7
        // BEGIN: synchronize.anObject
jtulach@144
     8
        synchronized (anObject) {
jtulach@144
     9
            // do the critical stuff
jtulach@144
    10
        }
jtulach@144
    11
        // END: synchronize.anObject
jtulach@144
    12
    }
jtulach@144
    13
}