Skip to content

Commit

Permalink
Implement some AbstractInMemoryMemoizingEvaluator methods in terms …
Browse files Browse the repository at this point in the history
…of `InMemoryNodeEntry` to avoid impossible interrupt handling.

PiperOrigin-RevId: 592915126
Change-Id: I2bdbaa527cc7a14e9d7b6a83c2fe962fdbe85759
  • Loading branch information
justinhorvitz authored and copybara-github committed Dec 21, 2023
1 parent 4760212 commit 7a02916
Showing 1 changed file with 6 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
package com.google.devtools.build.skyframe;

import com.google.common.collect.Iterables;
import com.google.devtools.build.skyframe.QueryableGraph.Reason;
import java.io.PrintStream;
import java.util.Collection;
import java.util.HashMap;
Expand Down Expand Up @@ -44,29 +43,21 @@ private static boolean isDone(@Nullable NodeEntry entry) {
@Override
@Nullable
public final SkyValue getExistingValue(SkyKey key) {
NodeEntry entry = getExistingEntryAtCurrentlyEvaluatingVersion(key);
try {
return isDone(entry) ? entry.getValue() : null;
} catch (InterruptedException e) {
throw new IllegalStateException("InMemoryGraph does not throw" + key + ", " + entry, e);
}
InMemoryNodeEntry entry = getExistingEntryAtCurrentlyEvaluatingVersion(key);
return isDone(entry) ? entry.getValue() : null;
}

@Override
@Nullable
public final ErrorInfo getExistingErrorForTesting(SkyKey key) {
NodeEntry entry = getExistingEntryAtCurrentlyEvaluatingVersion(key);
try {
return isDone(entry) ? entry.getErrorInfo() : null;
} catch (InterruptedException e) {
throw new IllegalStateException("InMemoryGraph does not throw" + key + ", " + entry, e);
}
InMemoryNodeEntry entry = getExistingEntryAtCurrentlyEvaluatingVersion(key);
return isDone(entry) ? entry.getErrorInfo() : null;
}

@Nullable
@Override
public final NodeEntry getExistingEntryAtCurrentlyEvaluatingVersion(SkyKey key) {
return getInMemoryGraph().get(null, Reason.OTHER, key);
public final InMemoryNodeEntry getExistingEntryAtCurrentlyEvaluatingVersion(SkyKey key) {
return getInMemoryGraph().getIfPresent(key);
}

@Override
Expand Down

0 comments on commit 7a02916

Please sign in to comment.