QueueThing: add ability to request a specific item for processing.

This commit is contained in:
Nekojimi 2024-04-21 16:46:07 +01:00
parent 88c51129d2
commit 8f35828c84
1 changed files with 12 additions and 0 deletions

View File

@ -74,6 +74,18 @@ public abstract class QueueThing<I, O> implements Consumer<I>
} }
} }
public List<Promise<I, O>> requestSpecific(List<I> inputs, Consumer<O> destination)
{
List<Promise<I, O>> ret = new ArrayList<>();
for (I input : inputs)
{
Promise<I, O> promise = new Promise<>(input, destination);
ret.add(promise);
handlePromise(promise);
}
return ret;
}
public List<Promise<I, O>> request(int count, Consumer<O> destination) public List<Promise<I, O>> request(int count, Consumer<O> destination)
{ {
List<Promise<I, O>> ret = new ArrayList<>(); List<Promise<I, O>> ret = new ArrayList<>();