aboutsummaryrefslogtreecommitdiff
path: root/usage_examples/SynchronizedExample_pre.jpage
blob: f1e8afbad06931b86ef768637bad86f4106dc960 (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 myLock = new Object();
	
	@Synchronized
	public static void hello() {
		System.out.println("world");
	}
	
	@Synchronized
	public int answerToLife() {
		return 42;
	}
	
	@Synchronized("myLock")
	public void foo() {
		System.out.println("bar");
	}
}