MCPcopy Create free account
hub / github.com/Card-Forge/forge / limit

Method limit

forge-core/src/main/java/forge/util/ThreadUtil.java:56–69  ·  view source on GitHub ↗
(Callable<T> task, long millis)

Source from the content-addressed store, hash-verified

54 service = Executors.newWorkStealingPool();
55 }
56 public static <T> T limit(Callable<T> task, long millis){
57 Future<T> future = null;
58 T result;
59 try {
60 future = service.submit(task);
61 result = future.get(millis, TimeUnit.MILLISECONDS);
62 } catch (Exception e) {
63 result = null;
64 } finally {
65 if (future != null)
66 future.cancel(true);
67 }
68 return result;
69 }
70 public static <T> T executeWithTimeout(Callable<T> task, int milliseconds) {
71 ExecutorService executor = Executors.newCachedThreadPool();
72 Future<T> future = executor.submit(task);

Callers 15

getCardsInMethod · 0.80
millMethod · 0.80
resolveMethod · 0.80
blurMethod · 0.80
packMethod · 0.80
AlphaMethod · 0.80
BetaMethod · 0.80
AssignmentCounterMethod · 0.80
bulkSlotReplacementMethod · 0.80
printUnknownsMethod · 0.80
exileFromTopGraveTypeMethod · 0.80

Calls 2

getMethod · 0.65
cancelMethod · 0.65

Tested by 6

aggregateMetricsMethod · 0.64
getAllErrorsMethod · 0.64
getAllWarningsMethod · 0.64
generateReportMethod · 0.64
tuckCardsViaMulliganMethod · 0.64
chooseCardsForCostMethod · 0.64