improve WaitListCase: fix free variable capture
@@ -68,6 +68,7 @@ class ChainTaskWaitListCase extends SubCase {
latches.add(new LatchTask("task3"))
latches.each {
+ def lat = it
thdf.chainSubmit(new ChainTask(null) {
@Override
String getSyncSignature() {
@@ -76,13 +77,13 @@ class ChainTaskWaitListCase extends SubCase {
@Override
void run(SyncTaskChain chain) {
- it.lock()
+ lat.lock()
chain.next()
}
@Override
String getName() {
- return it.name
+ return lat.name
}
})
}
@@ -117,6 +118,7 @@ class ChainTaskWaitListCase extends SubCase {
//def latches = [new LatchTask("task1"), new LatchTask("task2"), new LatchTask("task3"), new LatchTask("task4")]
latches.each {
+ def lat = it
thdf.chainSubmit(new ChainTask(null) {
@Override
String getSyncSignature() {
@@ -125,13 +127,13 @@ class ChainTaskWaitListCase extends SubCase {
@Override
void run(SyncTaskChain chain) {
- it.execute()
+ lat.execute()
chain.next()
}
@Override
String getName() {
- return it.name
+ return lat.name
}
@Override
@@ -141,7 +143,7 @@ class ChainTaskWaitListCase extends SubCase {
@Override
void exceedMaxPendingCallback() {
- it.throwed()
+ lat.throwed()
}
@Override
@@ -220,6 +222,7 @@ class ChainTaskWaitListCase extends SubCase {
// def latches2 = [new LatchTask("task2-1"), new LatchTask("task2-2"), new LatchTask("task2-3")]
latches1.each {
+ def lat = it
thdf.chainSubmit(new ChainTask(null) {
@Override
String getSyncSignature() {
@@ -228,13 +231,13 @@ class ChainTaskWaitListCase extends SubCase {
@Override
void run(SyncTaskChain chain) {
- it.execute()
+ lat.execute()
chain.next()
}
@Override
String getName() {
- return it.name
+ return lat.name
}
@Override
@@ -244,7 +247,7 @@ class ChainTaskWaitListCase extends SubCase {
@Override
void exceedMaxPendingCallback() {
- it.throwed()
+ lat.throwed()
}
@Override
@@ -256,6 +259,7 @@ class ChainTaskWaitListCase extends SubCase {
}
latches2.each {
+ def lat = it
thdf.chainSubmit(new ChainTask(null) {
@Override
String getSyncSignature() {
@@ -264,13 +268,13 @@ class ChainTaskWaitListCase extends SubCase {
@Override
void run(SyncTaskChain chain) {
- it.execute()
+ lat.execute()
chain.next()
}
@Override
String getName() {
- return it.name
+ return lat.name
}
@Override
@@ -280,7 +284,7 @@ class ChainTaskWaitListCase extends SubCase {
@Override
void exceedMaxPendingCallback() {
- it.throwed()
+ lat.throwed()
}
@Override
