diff options
author | aclement <aclement> | 2006-05-24 07:15:42 +0000 |
---|---|---|
committer | aclement <aclement> | 2006-05-24 07:15:42 +0000 |
commit | b2247654a3b35eb26731fac20247fc3007612eab (patch) | |
tree | 3b3bc6d6e2833e1d62aaf4506b1e8e3f4d12f51d /tests/features152/synchronization/AroundLock.java | |
parent | 917a3a70f5c09f16151200f13eb89283c4bb2abf (diff) | |
download | aspectj-b2247654a3b35eb26731fac20247fc3007612eab.tar.gz aspectj-b2247654a3b35eb26731fac20247fc3007612eab.zip |
synchronization joinpoints: testcode
Diffstat (limited to 'tests/features152/synchronization/AroundLock.java')
-rw-r--r-- | tests/features152/synchronization/AroundLock.java | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/tests/features152/synchronization/AroundLock.java b/tests/features152/synchronization/AroundLock.java new file mode 100644 index 000000000..048fc8cd5 --- /dev/null +++ b/tests/features152/synchronization/AroundLock.java @@ -0,0 +1,41 @@ +// around advice and lock + +public aspect AroundLock { + + String s = "foo"; +// void around(Object f): lock() && args(f) { +// System.err.println("around(Object) lock: advice running at "+thisJoinPoint.getSourceLocation()); +// proceed(f); +// } + + void around(Object f): lock() && args(f){ + System.err.println("around() lock: advice running at "+thisJoinPoint.getSourceLocation()); + proceed(s); + proceed(s); + } + + void around(Object f): unlock() && args(f) { + System.err.println("around() unlock: advice running at "+thisJoinPoint.getSourceLocation()); + proceed(s); + proceed(s); + } + + public static void main(String[] args) { + Foo aFoo = new Foo(); + aFoo.staticM(); + aFoo.nonstaticM(); + } + + static class Foo { + public void nonstaticM() { + synchronized (this) { + System.err.println("non-static method running"); + } + } + public static void staticM() { + synchronized (String.class) { + System.err.println("static method running"); + } + } + } +}
\ No newline at end of file |