Skip to content

Commit

Permalink
add log lines
Browse files Browse the repository at this point in the history
  • Loading branch information
ektavarma10 committed Nov 29, 2023
1 parent dc0efc2 commit 3f64c95
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -643,6 +643,8 @@ public void filterTypesDef(AtlasTypesDefFilterRequest request) throws AtlasAutho

private void checkAccessAndScrubAsync(List<AtlasEntityHeader> entitiesToCheck, AtlasSearchResultScrubRequest request, boolean isScrubAuditEnabled) throws AtlasAuthorizationException {
LOG.info("Creating futures to check access and scrub " + entitiesToCheck.size() + " entities");
long startTime = System.currentTimeMillis();
LOG.info("Started checkAccessAndScrubAsync: " + System.currentTimeMillis());
List<CompletableFuture<AtlasAuthorizationException>> completableFutures = entitiesToCheck
.stream()
.map(entity -> CompletableFuture.supplyAsync(() -> {
Expand All @@ -654,18 +656,18 @@ private void checkAccessAndScrubAsync(List<AtlasEntityHeader> entitiesToCheck, A
}
}, entityAccessThreadpool))
.collect(Collectors.toList());

LOG.info("Completed async submission " + (System.currentTimeMillis()-startTime));
// wait for all threads to complete their execution
CompletableFuture.allOf(completableFutures.toArray(new CompletableFuture[0])).join();

LOG.info("Completed waiting for completion of threads: " + (System.currentTimeMillis()-startTime));
// get the first exception from any checkAccessAndScrub calls
Optional<AtlasAuthorizationException> maybeAuthException = completableFutures
.stream()
.map(CompletableFuture::join)
.filter(Objects::nonNull)
.findFirst();

LOG.info("Async check access and scrub is complete");
LOG.info("Async check access and scrub is complete: "+ (System.currentTimeMillis()-startTime));
if (maybeAuthException.isPresent()) {
throw maybeAuthException.get();
}
Expand Down

0 comments on commit 3f64c95

Please sign in to comment.