Merge pull request #617 from DataDog/mar-kolya/java-concurrent-test-cleanup
Remove unused variable from AsyncChild classes
This commit is contained in:
commit
30712cdc87
|
@ -1,18 +1,16 @@
|
||||||
import datadog.trace.api.Trace;
|
import datadog.trace.api.Trace;
|
||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
|
||||||
|
|
||||||
public class AsyncChild implements Runnable, Callable {
|
public class AsyncChild implements Runnable, Callable {
|
||||||
private final AtomicBoolean blockThread;
|
private final AtomicBoolean blockThread;
|
||||||
private final boolean doTraceableWork;
|
private final boolean doTraceableWork;
|
||||||
private final AtomicInteger numberOfWorkers = new AtomicInteger(0);
|
|
||||||
|
|
||||||
public AsyncChild() {
|
public AsyncChild() {
|
||||||
this(true, false);
|
this(true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public AsyncChild(boolean doTraceableWork, boolean blockThread) {
|
public AsyncChild(final boolean doTraceableWork, final boolean blockThread) {
|
||||||
this.doTraceableWork = doTraceableWork;
|
this.doTraceableWork = doTraceableWork;
|
||||||
this.blockThread = new AtomicBoolean(blockThread);
|
this.blockThread = new AtomicBoolean(blockThread);
|
||||||
}
|
}
|
||||||
|
@ -36,13 +34,8 @@ public class AsyncChild implements Runnable, Callable {
|
||||||
if (doTraceableWork) {
|
if (doTraceableWork) {
|
||||||
asyncChild();
|
asyncChild();
|
||||||
}
|
}
|
||||||
numberOfWorkers.getAndIncrement();
|
while (blockThread.get()) {
|
||||||
try {
|
// busy-wait to block thread
|
||||||
while (blockThread.get()) {
|
|
||||||
// busy-wait to block thread
|
|
||||||
}
|
|
||||||
} finally {
|
|
||||||
numberOfWorkers.getAndDecrement();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,10 @@
|
||||||
import datadog.trace.api.Trace;
|
import datadog.trace.api.Trace;
|
||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
|
||||||
|
|
||||||
public class AsyncChild implements Runnable, Callable {
|
public class AsyncChild implements Runnable, Callable {
|
||||||
private final AtomicBoolean blockThread;
|
private final AtomicBoolean blockThread;
|
||||||
private final boolean doTraceableWork;
|
private final boolean doTraceableWork;
|
||||||
private final AtomicInteger numberOfWorkers = new AtomicInteger(0);
|
|
||||||
|
|
||||||
public AsyncChild() {
|
public AsyncChild() {
|
||||||
this(true, false);
|
this(true, false);
|
||||||
|
@ -36,13 +34,8 @@ public class AsyncChild implements Runnable, Callable {
|
||||||
if (doTraceableWork) {
|
if (doTraceableWork) {
|
||||||
asyncChild();
|
asyncChild();
|
||||||
}
|
}
|
||||||
numberOfWorkers.getAndIncrement();
|
while (blockThread.get()) {
|
||||||
try {
|
// busy-wait to block thread
|
||||||
while (blockThread.get()) {
|
|
||||||
// busy-wait to block thread
|
|
||||||
}
|
|
||||||
} finally {
|
|
||||||
numberOfWorkers.getAndDecrement();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue