|
62 | 62 | import java.util.LinkedHashMap;
|
63 | 63 | import java.util.List;
|
64 | 64 | import java.util.Map;
|
65 |
| -import java.util.Optional; |
66 | 65 | import java.util.PriorityQueue;
|
67 | 66 | import java.util.Set;
|
68 | 67 | import java.util.TreeMap;
|
69 | 68 | import java.util.concurrent.ConcurrentHashMap;
|
70 | 69 | import java.util.concurrent.atomic.AtomicInteger;
|
71 | 70 | import javax.annotation.Nullable;
|
72 |
| -import javax.annotation.concurrent.GuardedBy; |
73 | 71 | import javax.annotation.concurrent.ThreadSafe;
|
74 | 72 |
|
75 | 73 | /** Tracks state for the UI. */
|
@@ -230,7 +228,6 @@ private ProgressState(String id, long nanoStartTime) {
|
230 | 228 | }
|
231 | 229 | }
|
232 | 230 |
|
233 |
| - @GuardedBy("this") |
234 | 231 | private final LinkedHashMap<String, ProgressState> runningProgresses = new LinkedHashMap<>();
|
235 | 232 |
|
236 | 233 | /** Starts tracking the state of an action. */
|
@@ -336,13 +333,6 @@ synchronized void onProgressEvent(ActionProgressEvent event, long nanoChangeTime
|
336 | 333 | state.latestEvent = event;
|
337 | 334 | }
|
338 | 335 |
|
339 |
| - synchronized Optional<ProgressState> firstProgress() { |
340 |
| - if (runningProgresses.isEmpty()) { |
341 |
| - return Optional.empty(); |
342 |
| - } |
343 |
| - return Optional.of(runningProgresses.entrySet().iterator().next().getValue()); |
344 |
| - } |
345 |
| - |
346 | 336 | /** Generates a human-readable description of this action's state. */
|
347 | 337 | synchronized String describe() {
|
348 | 338 | if (runningStrategiesBitmap != 0) {
|
@@ -715,12 +705,12 @@ private String describeTestGroup(
|
715 | 705 | }
|
716 | 706 |
|
717 | 707 | private String describeActionProgress(ActionState action, int desiredWidth) {
|
718 |
| - Optional<ActionState.ProgressState> stateOpt = action.firstProgress(); |
719 |
| - if (!stateOpt.isPresent()) { |
| 708 | + if (action.runningProgresses.isEmpty()) { |
720 | 709 | return "";
|
721 | 710 | }
|
722 | 711 |
|
723 |
| - ActionState.ProgressState state = stateOpt.get(); |
| 712 | + ActionState.ProgressState state = |
| 713 | + action.runningProgresses.entrySet().iterator().next().getValue(); |
724 | 714 | ActionProgressEvent event = state.latestEvent;
|
725 | 715 | String message = event.progress();
|
726 | 716 | if (message.isEmpty()) {
|
|
0 commit comments