Klasse BoundedAsyncOperationQueue
java.lang.Object
de.delinkedde.areashopreborn.application.BoundedAsyncOperationQueue
- Alle implementierten Schnittstellen:
AutoCloseable
Serializes asynchronous operations without owning or blocking a thread.
The bounded queue protects the server from multiplying per-tick work when many users start expensive workflows simultaneously. Priority submissions are intended for compensation and recovery work and are placed before ordinary waiting jobs.
-
Konstruktorübersicht
KonstruktorenKonstruktorBeschreibungBoundedAsyncOperationQueue(int maximumQueued) Creates a serial asynchronous operation queue. -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungvoidclose()Rejects new and waiting jobs while allowing the already active stage to finish.<T> CompletableFuture<T> submit(Supplier<CompletableFuture<T>> operation) Submits ordinary work behind already waiting jobs.<T> CompletableFuture<T> submitPriority(Supplier<CompletableFuture<T>> operation) Submits recovery work before ordinary waiting jobs.
-
Konstruktordetails
-
BoundedAsyncOperationQueue
public BoundedAsyncOperationQueue(int maximumQueued) Creates a serial asynchronous operation queue.- Parameter:
maximumQueued- maximum waiting jobs in addition to the active job
-
-
Methodendetails
-
submit
Submits ordinary work behind already waiting jobs.- Typparameter:
T- result type- Parameter:
operation- lazy asynchronous operation- Gibt zurück:
- future completed with the operation result
-
submitPriority
Submits recovery work before ordinary waiting jobs.- Typparameter:
T- result type- Parameter:
operation- lazy asynchronous recovery operation- Gibt zurück:
- future completed with the operation result
-
close
public void close()Rejects new and waiting jobs while allowing the already active stage to finish.- Angegeben von:
closein SchnittstelleAutoCloseable
-