From bc35f73ae80802ab6758509481dacd66c5dc3285 Mon Sep 17 00:00:00 2001 From: Reinier Zwitserloot Date: Sat, 18 Jul 2009 02:28:29 +0200 Subject: Added text for the Synchronized annotation to the features pages. Also did some fixes in regards to whitespacing (some fancy footwork in regards to white-space: pre). --- usage_examples/SynchronizedExample_post.jpage | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 usage_examples/SynchronizedExample_post.jpage (limited to 'usage_examples/SynchronizedExample_post.jpage') diff --git a/usage_examples/SynchronizedExample_post.jpage b/usage_examples/SynchronizedExample_post.jpage new file mode 100644 index 00000000..858bfbde --- /dev/null +++ b/usage_examples/SynchronizedExample_post.jpage @@ -0,0 +1,23 @@ +public class SynchronizedExample { + private static final Object $LOCK = new Object[0]; + private final Object $lock = new Object[0]; + private final Object myLock = new Object(); + + public static void hello() { + synchronized($LOCK) { + System.out.println("world"); + } + } + + public int answerToLife() { + synchronized($lock) { + return 42; + } + } + + public void foo() { + synchronized(myLock) { + System.out.println("bar"); + } + } +} -- cgit