Skip to content
This repository has been archived by the owner on Jun 28, 2024. It is now read-only.

Commit

Permalink
Uses ConcurrentLinkedDeque as a thread safe queue
Browse files Browse the repository at this point in the history
  • Loading branch information
Janusz Baginski committed Jun 21, 2024
1 parent d08d644 commit a68ba85
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import org.slf4j.LoggerFactory;

import java.io.IOException;
import java.util.Queue;
import java.util.Deque;

import static com.shazam.fork.system.io.RemoteFileManager.*;

Expand All @@ -32,15 +32,15 @@ public class DeviceTestRunner implements Runnable {
private final Installer installer;
private final Pool pool;
private final Device device;
private final Queue<TestCaseEvent> queueOfTestsInPool;
private final Deque<TestCaseEvent> queueOfTestsInPool;
private final ProgressReporter progressReporter;
private final ScreenRecorder screenRecorder;
private final TestRunFactory testRunFactory;

public DeviceTestRunner(Installer installer,
Pool pool,
Device device,
Queue<TestCaseEvent> queueOfTestsInPool,
Deque<TestCaseEvent> queueOfTestsInPool,
ProgressReporter progressReporter,
ScreenRecorder screenRecorder,
TestRunFactory testRunFactory) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import com.shazam.fork.model.TestCaseEvent;
import com.shazam.fork.system.adb.Installer;

import java.util.Queue;
import java.util.Deque;

public class DeviceTestRunnerFactory {

Expand All @@ -29,7 +29,7 @@ public DeviceTestRunnerFactory(Installer installer, TestRunFactory testRunFactor
}

public Runnable createDeviceTestRunner(Pool pool,
Queue<TestCaseEvent> testClassQueue,
Deque<TestCaseEvent> testClassQueue,
Device device,
ProgressReporter progressReporter
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Queue;
import java.util.Deque;
import java.util.concurrent.ExecutorService;

import static com.google.common.util.concurrent.Uninterruptibles.awaitTerminationUninterruptibly;
Expand All @@ -30,12 +30,12 @@ public class PoolTestRunner implements Runnable {
public static final String DROPPED_BY = "DroppedBy-";

private final Pool pool;
private final Queue<TestCaseEvent> testCases;
private final Deque<TestCaseEvent> testCases;
private final DeviceTestRunnerFactory deviceTestRunnerFactory;
private final ProgressReporter progressReporter;

public PoolTestRunner(DeviceTestRunnerFactory deviceTestRunnerFactory, Pool pool,
Queue<TestCaseEvent> testCases,
Deque<TestCaseEvent> testCases,
ProgressReporter progressReporter) {
this.pool = pool;
this.testCases = testCases;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import com.shazam.fork.model.TestCaseEvent;

import java.util.Collection;
import java.util.LinkedList;
import java.util.concurrent.ConcurrentLinkedDeque;

public class PoolTestRunnerFactory {
private final DeviceTestRunnerFactory deviceTestRunnerFactory;
Expand All @@ -33,7 +33,7 @@ public Runnable createPoolTestRunner(Pool pool,
return new PoolTestRunner(
deviceTestRunnerFactory,
pool,
new LinkedList<>(testCases),
new ConcurrentLinkedDeque<>(testCases),
progressReporter);
}
}

0 comments on commit a68ba85

Please sign in to comment.