aboutsummaryrefslogtreecommitdiff
path: root/usage_examples/SynchronizedExample_pre.jpage
blob: ace39f856b68d98ddc9bc8ecad8339f473fab569 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import lombok.Synchronized;

public class SynchronizedExample {
	private final Object readLock = new Object();
	
	@Synchronized
	public static void hello() {
		System.out.println("world");
	}
	
	@Synchronized
	public int answerToLife() {
		return 42;
	}
	
	@Synchronized("readLock")
	public void foo() {
		System.out.println("bar");
	}
}