blob: dfe62fd2363ff165352d0453a540c78dfe709502 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
package foo;
//@ProfileMe
//@ThreadSafe
@Synchronized//(timeout = 2, unit = TimeUnit.SECONDS)
public final class SynchronizedTest { //implements Runnable {
@Synchronized
public void incrementCounter() {
/*
int n = counter;
log.debug("counter read (" + n + ")");
ThreadUtil.sleep();
n++;
log.debug("counter increased (" + n + ")");
ThreadUtil.sleep();
counter = n;
log.debug("counter written (" + n + ")");
*/
}
public void run() {
// incrementCounter();
}
}
|