Skip to content

Commit

Permalink
Synchronise JoinPointImpl methods dealing with Stack<AroundClosure>
Browse files Browse the repository at this point in the history
If we do not synchronise, we will run into problems with nested
around-aspects in combination with proceeding asynchronously (in another
thread).

Fixes eclipse-aspectj#128.

Signed-off-by: Alexander Kriegisch <[email protected]>
  • Loading branch information
kriegaex committed Feb 26, 2022
1 parent 102e061 commit a3e3680
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ public final String toLongString() {
this.arc = arc;
}

public void stack$AroundClosure(AroundClosure arc) {
public synchronized void stack$AroundClosure(AroundClosure arc) {
// If input parameter arc is null this is the 'unlink' call from AroundClosure
if (arcs == null) {
arcs = new Stack<>();
Expand All @@ -158,7 +158,7 @@ public final String toLongString() {
}
}

public Object proceed() throws Throwable {
public synchronized Object proceed() throws Throwable {
// when called from a before advice, but be a no-op
if (arcs == null) {
if (arc == null) {
Expand All @@ -171,7 +171,7 @@ public Object proceed() throws Throwable {
}
}

public Object proceed(Object[] adviceBindings) throws Throwable {
public synchronized Object proceed(Object[] adviceBindings) throws Throwable {
// when called from a before advice, but be a no-op
AroundClosure ac = null;
if (arcs == null) {
Expand Down

0 comments on commit a3e3680

Please sign in to comment.