Propagate InterruptedException from NestedSetVisitor.

PiperOrigin-RevId: 293049964
diff --git a/src/main/java/com/google/devtools/build/lib/collect/nestedset/NestedSet.java b/src/main/java/com/google/devtools/build/lib/collect/nestedset/NestedSet.java
index 0e02e7a..52a6588 100644
--- a/src/main/java/com/google/devtools/build/lib/collect/nestedset/NestedSet.java
+++ b/src/main/java/com/google/devtools/build/lib/collect/nestedset/NestedSet.java
@@ -209,6 +209,11 @@
     return getChildrenUninterruptibly();
   }
 
+  /** Same as {@link #getChildren}, except propagates {@link InterruptedException}. */
+  Object getChildrenInterruptibly() throws InterruptedException {
+    return getChildren(/*handleInterruptedException=*/ true);
+  }
+
   /** Implementation of {@link #getChildren} that will catch an InterruptedException and crash. */
   private Object getChildrenUninterruptibly() {
     if (children instanceof ListenableFuture) {
diff --git a/src/main/java/com/google/devtools/build/lib/collect/nestedset/NestedSetVisitor.java b/src/main/java/com/google/devtools/build/lib/collect/nestedset/NestedSetVisitor.java
index 4a75c6d..1a36ff9 100644
--- a/src/main/java/com/google/devtools/build/lib/collect/nestedset/NestedSetVisitor.java
+++ b/src/main/java/com/google/devtools/build/lib/collect/nestedset/NestedSetVisitor.java
@@ -55,12 +55,12 @@
    *
    * @param nestedSet the nested set to visit transitively.
    */
-  public void visit(NestedSet<E> nestedSet) {
+  public void visit(NestedSet<E> nestedSet) throws InterruptedException {
     Preconditions.checkArgument(nestedSet.getOrder() == Order.STABLE_ORDER);
     // We can short-circuit empty nested set visitation here, avoiding load on the shared map
     // VisitedState#seenNodes.
     if (!nestedSet.isEmpty()) {
-      visitRaw(nestedSet.getChildren());
+      visitRaw(nestedSet.getChildrenInterruptibly());
     }
   }