diff options
Diffstat (limited to 'website2/usageExamples/SynchronizedExample_pre.jpage')
-rw-r--r-- | website2/usageExamples/SynchronizedExample_pre.jpage | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/website2/usageExamples/SynchronizedExample_pre.jpage b/website2/usageExamples/SynchronizedExample_pre.jpage new file mode 100644 index 00000000..ace39f85 --- /dev/null +++ b/website2/usageExamples/SynchronizedExample_pre.jpage @@ -0,0 +1,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"); + } +} |