MCPcopy Index your code
hub / github.com/SeleniumHQ/selenium / safelyCall

Method safelyCall

java/test/org/openqa/selenium/testing/Safely.java:34–62  ·  view source on GitHub ↗
(TearDownFixture... fixtures)

Source from the content-addressed store, hash-verified

32 private static final Logger LOG = Logger.getLogger(Safely.class.getName());
33
34 public static void safelyCall(TearDownFixture... fixtures) {
35 ExecutorService executor = Executors.newFixedThreadPool(fixtures.length);
36 List<CompletableFuture<Void>> futures = new LinkedList<>();
37
38 for (TearDownFixture fixture : fixtures) {
39 CompletableFuture<Void> check = new CompletableFuture<>();
40 executor.submit(
41 () -> {
42 // Fixture being null is handled by the exception check.
43 try {
44 fixture.tearDown();
45 } catch (Exception ignored) {
46 // nothing to see here.
47 }
48 check.complete(null);
49 });
50 futures.add(check);
51 }
52
53 executor.shutdown();
54
55 try {
56 CompletableFuture.allOf(futures.toArray(new CompletableFuture[] {})).get(2, TimeUnit.MINUTES);
57 } catch (TimeoutException ex) {
58 LOG.log(Level.WARNING, "tear down timed out: {}", ex.toString());
59 } catch (Exception ex) {
60 LOG.log(Level.WARNING, "tear down failed", ex);
61 }
62 }
63}

Callers 15

tearDownDeploymentMethod · 0.95
stopServersMethod · 0.95
waitUntilReadyMethod · 0.95
stopServersMethod · 0.95
shutDownMethod · 0.95
stopServersMethod · 0.80
closeClientMethod · 0.80
tearDownMethod · 0.80

Calls 9

toArrayMethod · 0.80
submitMethod · 0.65
tearDownMethod · 0.65
addMethod · 0.65
getMethod · 0.65
logMethod · 0.65
toStringMethod · 0.65
completeMethod · 0.45
shutdownMethod · 0.45

Tested by

no test coverage detected