Package dev.failsafe.internal.util
Class FutureLinkedList
- java.lang.Object
-
- dev.failsafe.internal.util.FutureLinkedList
-
public final class FutureLinkedList extends java.lang.Object
A LinkedList of CompletableFutures that removes a future from the list when it's completed.This class is threadsafe.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static class
FutureLinkedList.Node
-
Field Summary
Fields Modifier and Type Field Description (package private) FutureLinkedList.Node
head
(package private) FutureLinkedList.Node
tail
-
Constructor Summary
Constructors Constructor Description FutureLinkedList()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.concurrent.CompletableFuture<java.lang.Void>
add()
Adds a new CompletableFuture to the list and returns it.java.util.concurrent.CompletableFuture<java.lang.Void>
pollFirst()
Returns and removes the first future in the list, else returnsnull
if the list is empty.private void
remove(FutureLinkedList.Node node)
-
-
-
Field Detail
-
head
FutureLinkedList.Node head
-
tail
FutureLinkedList.Node tail
-
-
Method Detail
-
add
public java.util.concurrent.CompletableFuture<java.lang.Void> add()
Adds a new CompletableFuture to the list and returns it. The returned future will be removed from the list when it's completed.
-
pollFirst
public java.util.concurrent.CompletableFuture<java.lang.Void> pollFirst()
Returns and removes the first future in the list, else returnsnull
if the list is empty.
-
remove
private void remove(FutureLinkedList.Node node)
-
-