From ceb0f62bd8726ef4bb6799fe2711680c531d2c18 Mon Sep 17 00:00:00 2001 From: Klaus Aehlig Date: Mon, 20 Mar 2017 13:52:06 +0000 Subject: BuildEventStreamer: fix handling of postedEvents Always initialize the set of postedEvents. Also, record the initial event as posted. In this way, the build event streamer can also handle events that should be posted after the BuildStartedEvent but are told the streamer about earlier. -- Change-Id: Ic796f2434434819e6c62633755411527a9dcb7e0 Reviewed-on: https://cr.bazel.build/9451 PiperOrigin-RevId: 150620387 MOS_MIGRATED_REVID=150620387 --- .../google/devtools/build/lib/runtime/BuildEventStreamer.java | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/google/devtools/build/lib/runtime/BuildEventStreamer.java b/src/main/java/com/google/devtools/build/lib/runtime/BuildEventStreamer.java index c0c50958b5..a79297d396 100644 --- a/src/main/java/com/google/devtools/build/lib/runtime/BuildEventStreamer.java +++ b/src/main/java/com/google/devtools/build/lib/runtime/BuildEventStreamer.java @@ -43,8 +43,8 @@ import java.util.logging.Logger; public class BuildEventStreamer implements EventHandler { private final Collection transports; private Set announcedEvents; - private Set postedEvents; - private final Multimap pendingEvents; + private final Set postedEvents = new HashSet<>(); + private final Multimap pendingEvents = HashMultimap.create(); private int progressCount; private AbortReason abortReason = AbortReason.UNKNOWN; private static final Logger log = Logger.getLogger(BuildEventStreamer.class.getName()); @@ -52,9 +52,7 @@ public class BuildEventStreamer implements EventHandler { public BuildEventStreamer(Collection transports) { this.transports = transports; this.announcedEvents = null; - this.postedEvents = null; this.progressCount = 0; - this.pendingEvents = HashMultimap.create(); } /** @@ -71,7 +69,6 @@ public class BuildEventStreamer implements EventHandler { synchronized (this) { if (announcedEvents == null) { announcedEvents = new HashSet<>(); - postedEvents = new HashSet<>(); if (!event.getChildrenEvents().contains(ProgressEvent.INITIAL_PROGRESS_UPDATE)) { linkEvent = ProgressEvent.progressChainIn(progressCount, event.getEventId()); progressCount++; @@ -85,8 +82,8 @@ public class BuildEventStreamer implements EventHandler { announcedEvents.addAll(linkEvent.getChildrenEvents()); postedEvents.add(linkEvent.getEventId()); } - postedEvents.add(id); } + postedEvents.add(id); announcedEvents.addAll(event.getChildrenEvents()); } -- cgit v1.2.3