public class TimeConstrained extends Object
Constructor and Description |
---|
TimeConstrained() |
Modifier and Type | Method and Description |
---|---|
static <T> T |
timeConstrained(Callable<T> lambda,
long millis)
Runs lambda, stopping after specified number of milliseconds
|
static <T> T |
timeConstrained(Callable<T> lambda,
long millis,
T failExpr)
Runs lambda, stopping after specified number of milliseconds
|
static <T> T |
timeConstrained0(Callable<T> lambda,
long millis,
T failExpr)
Runs lambda, stopping after specified number of milliseconds
|
public static <T> T timeConstrained0(Callable<T> lambda, long millis, T failExpr) throws InterruptedException, ExecutionException
lambda
- code blockmillis
- time constrained in millisecondsfailExpr
- returns this if the time constraint is not metInterruptedException
ExecutionException
public static <T> T timeConstrained(Callable<T> lambda, long millis, T failExpr)
lambda
- code blockmillis
- time constrained in millisecondsfailExpr
- returns this if the time constraint is not metpublic static <T> T timeConstrained(Callable<T> lambda, long millis) throws InterruptedException, ExecutionException
lambda
- code blockmillis
- time constrained in millisecondsInterruptedException
ExecutionException
Copyright © 2018. All rights reserved.