Browse Source

Cleaning up thread locals when counters/stacks hit zero

tags/AS_BETA_JAVA8_CREATED
Andy Clement 11 years ago
parent
commit
dd41751ab2

+ 3
- 0
runtime/src/org/aspectj/runtime/internal/CFlowCounter.java View File

@@ -39,6 +39,9 @@ public class CFlowCounter {

public void dec() {
flowHeightHandler.dec();
if (!flowHeightHandler.isNotZero()) {
flowHeightHandler.removeThreadCounter();
}
}
public boolean isValid() {

+ 5
- 1
runtime/src/org/aspectj/runtime/internal/CFlowStack.java View File

@@ -81,7 +81,11 @@ public class CFlowStack {
}

public void pop() {
getThreadStack().pop();
Stack s = getThreadStack();
s.pop();
if (s.isEmpty()) {
stackProxy.removeThreadStack();
}
}

public Object peek() {

+ 1
- 0
runtime/src/org/aspectj/runtime/internal/cflowstack/ThreadCounter.java View File

@@ -18,4 +18,5 @@ public interface ThreadCounter {
public void inc();
public void dec();
public boolean isNotZero();
public void removeThreadCounter();
}

+ 4
- 0
runtime/src/org/aspectj/runtime/internal/cflowstack/ThreadCounterImpl11.java View File

@@ -71,4 +71,8 @@ public class ThreadCounterImpl11 implements ThreadCounter {
return getThreadCounter().value!=0;
}

public void removeThreadCounter() {
// TODO
}

}

+ 1
- 0
runtime/src/org/aspectj/runtime/internal/cflowstack/ThreadStack.java View File

@@ -18,5 +18,6 @@ import java.util.Stack;
public interface ThreadStack {

public Stack getThreadStack();
public void removeThreadStack();

}

+ 7
- 0
runtime/src/org/aspectj/runtime/internal/cflowstack/ThreadStackFactoryImpl.java View File

@@ -23,6 +23,9 @@ public class ThreadStackFactoryImpl implements ThreadStackFactory {
public Stack getThreadStack() {
return (Stack)get();
}
public void removeThreadStack() {
this.remove();
}
}

public ThreadStack getNewThreadStack() {
@@ -38,6 +41,10 @@ public class ThreadStackFactoryImpl implements ThreadStackFactory {
return (Counter)get();
}
public void removeThreadCounter() {
this.remove();
}
public void inc() { getThreadCounter().value++; }
public void dec() { getThreadCounter().value--; }
public boolean isNotZero() { return getThreadCounter().value!= 0; }

+ 4
- 0
runtime/src/org/aspectj/runtime/internal/cflowstack/ThreadStackImpl11.java View File

@@ -52,4 +52,8 @@ public class ThreadStackImpl11 implements ThreadStack {
return cached_stack;
}

public void removeThreadStack() {
// TODO
}

}

Loading…
Cancel
Save