Package org.apache.sysds.runtime.ooc.cache

# Class OOCFuture<T>

java.lang.Object
org.apache.sysds.runtime.ooc.cache.OOCFuture<T>

public class OOCFuture<T> extends Object
Small future implementation for OOC hot paths. It supports multiple synchronous subscribers without the completion-stage support of `CompletableFuture`.

## Constructor Summary

Constructors
Constructor
Description
`OOCFuture()`

## Method Summary

Modifier and Type
Method
Description
`boolean`
`complete(T value)`
`static <T> OOCFuture<T>`
`completed(T value)`
`boolean`
`completeExceptionally(Throwable error)`
`static <T> OOCFuture<T>`
`failed(Throwable error)`
`T`
`get()`
`T`
`get(long timeout, TimeUnit unit)`
`T`
`getNow(T fallback)`
`boolean`
`isDone()`
`<R> OOCFuture<R>`
`map(Function<? super T,? extends R> mapper)`
`void`
`thenAccept(Consumer<? super T> action)`
`void`
`whenComplete(BiConsumer<? super T,? super Throwable> action)`

### Methods inherited from class java.lang.Object

`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### OOCFuture

public OOCFuture()

## Method Details

### completed

public static <T> OOCFuture<T> completed(T value)

### failed

public static <T> OOCFuture<T> failed(Throwable error)

### complete

public boolean complete(T value)

### completeExceptionally

public boolean completeExceptionally(Throwable error)

### thenAccept

public void thenAccept(Consumer<? super T> action)

### whenComplete

public void whenComplete(BiConsumer<? super T,? super Throwable> action)

### map

public <R> OOCFuture<R> map(Function<? super T,? extends R> mapper)

### isDone

public boolean isDone()

### getNow

public T getNow(T fallback)

### get

public T get() throws InterruptedException, ExecutionException

Throws:
  `InterruptedException`
  `ExecutionException`

### get

public T get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException

Throws:
  `InterruptedException`
  `ExecutionException`
  `TimeoutException`