use of javax.annotation.concurrent.ThreadSafe in project buck by facebook.
the class TargetNodeParsePipeline method computeNode.
@Override
protected TargetNode<?, ?> computeNode(final Cell cell, final BuildTarget buildTarget, final Map<String, Object> rawNode) throws BuildTargetException {
try (final SimplePerfEvent.Scope scope = SimplePerfEvent.scopeIgnoringShortEvents(eventBus, PerfEventId.of("GetTargetNode"), "target", buildTarget, targetNodePipelineLifetimeEventScope, getMinimumPerfEventTimeMs(), TimeUnit.MILLISECONDS)) {
Function<PerfEventId, SimplePerfEvent.Scope> perfEventScopeFunction = perfEventId -> SimplePerfEvent.scopeIgnoringShortEvents(eventBus, perfEventId, scope, getMinimumPerfEventTimeMs(), TimeUnit.MILLISECONDS);
final TargetNode<?, ?> targetNode = delegate.createTargetNode(cell, cell.getAbsolutePathToBuildFile(buildTarget), buildTarget, rawNode, perfEventScopeFunction);
if (speculativeDepsTraversal) {
executorService.submit(() -> {
for (BuildTarget depTarget : targetNode.getDeps()) {
Path depCellPath = depTarget.getCellPath();
// non-threadsafe way making it inconvenient to access from the pipeline.
if (depCellPath.equals(cell.getRoot())) {
try {
if (depTarget.isFlavored()) {
getNodeJob(cell, BuildTarget.of(depTarget.getUnflavoredBuildTarget()));
}
getNodeJob(cell, depTarget);
} catch (BuildTargetException e) {
// No biggie, we'll hit the error again in the non-speculative path.
LOG.info(e, "Could not schedule speculative parsing for %s", depTarget);
}
}
}
});
}
return targetNode;
}
}
Aggregations