Class ConcurrentLazy<V,T extends Exception>
- java.lang.Object
-
- jetbrains.buildServer.util.concurrent.ConcurrentLazy<V,T>
-
- Type Parameters:
V
- the type of the value the task will evaluate to.T
- the type of exception that the task may throw.
- All Implemented Interfaces:
Callable<V>
,CallableEx<V,T>
public final class ConcurrentLazy<V,T extends Exception> extends Object implements CallableEx<V,T>
A concurrent version of
Lazy
which uses a lock-free CAS (as opposed to DCL).- Since:
- 2017.2
- Author:
- Andrey Shcheglov <mailto:andrey.shcheglov@jetbrains.com>
- See Also:
Lazy
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description V
call()
static <V> ConcurrentLazy<V,Exception>
from(Callable<V> callable)
Creates a new lazy value from the specified task.static <V,T extends Exception>
ConcurrentLazy<V,T>from(CallableEx<V,T> callable, Class<T> exceptionType)
Creates a new lazy value from the specified task.
-
-
-
Method Detail
-
from
@NotNull public static <V> ConcurrentLazy<V,Exception> from(@NotNull Callable<V> callable)
Creates a new lazy value from the specified task.
- Type Parameters:
V
- the type of the value the task will evaluate to.- Parameters:
callable
- the task to be executed (once, in the best case).- Returns:
- the newly-created lazy value.
- See Also:
from(CallableEx, Class)
-
from
@NotNull public static <V,T extends Exception> ConcurrentLazy<V,T> from(@NotNull CallableEx<V,T> callable, @NotNull Class<T> exceptionType)
Creates a new lazy value from the specified task.
- Type Parameters:
V
- the type of the value the task will evaluate to.T
- the type of exception that the task may throw.- Parameters:
callable
- the task to be executed (once, in the best case).exceptionType
- the type of exception that the task may throw.- Returns:
- the newly-created lazy value.
- See Also:
from(Callable)
-
call
public V call() throws T extends Exception
- Specified by:
call
in interfaceCallable<V>
- Specified by:
call
in interfaceCallableEx<V,T extends Exception>
- Throws:
Error
- if thrown by the underlying callable task.RuntimeException
- if thrown by the underlying callable task, or the task throws a checked exception other thanT
, or the task is interrupted (in this last case, it's the client's responsibility to process the cause of the exception).T
- if unable to compute a result.T extends Exception
- See Also:
CallableEx.call()
-
-