Package space.maxus.flare.util
Interface SafeComputable<I,O>
- Type Parameters:
I- Input type of computableO- Output type of computable
- All Superinterfaces:
org.apache.commons.lang3.concurrent.Computable<I,O>
- All Known Implementing Classes:
SafeComputable.Wrapper
public interface SafeComputable<I,O>
extends org.apache.commons.lang3.concurrent.Computable<I,O>
Represents a computable that handles any errors inside itself
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final classThrown when error occurs inside SafeComputablestatic final class -
Method Summary
Modifier and TypeMethodDescriptiondefault OsafeCompute(I input) Safely computes the input, handling any errors inside itself, only throwing aSafeComputable.ComputeInterruptionExceptionif the thread is interruptedstatic <I,O> @NotNull SafeComputable<I, O> wrap(org.apache.commons.lang3.concurrent.Computable<I, O> c)
-
Method Details
-
wrap
@Contract("_ -> new") @NotNull static <I,O> @NotNull SafeComputable<I,O> wrap(org.apache.commons.lang3.concurrent.Computable<I, O> c) -
safeCompute
Safely computes the input, handling any errors inside itself, only throwing aSafeComputable.ComputeInterruptionExceptionif the thread is interrupted- Parameters:
input- Input value- Returns:
- Output value
-
compute
-