Package de.linusdev.lutils.async
Interface PTask<R,S>
- All Superinterfaces:
HasAsyncManager,Task<R,S>
- All Known Implementing Classes:
CompletableTask,ExecutableTaskBase,QueueableBase
Task with some methods, that should not be visible to the end user.- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionconsumeAndQueue(@Nullable Consumer<Future<R, S>> consumer) queue()Queues theTaskfor future asynchronous execution.queue(@NotNull ResultAndErrorConsumer<R, S> consumer) queue(@NotNull ResultConsumer<R, S> consumer) queue(@NotNull SingleResultConsumer<R, S> consumer) queueAndSetBeforeExecutionListener(@NotNull Consumer<Future<R, S>> consumer) default RqueueAndWriteToFile(@NotNull Path file, boolean overwriteIfExists, @Nullable ResultAndErrorConsumer<R, S> after) What exactly will be written to the file, depends on the implementation.Methods inherited from interface de.linusdev.lutils.async.manager.HasAsyncManager
getAsyncManagerMethods inherited from interface de.linusdev.lutils.async.Task
executeHere, getName
-
Method Details
-
consumeAndQueue
@NotNull @NotNull Future<R,S> consumeAndQueue(@Nullable @Nullable Consumer<Future<R, S>> consumer) throws CannotQueueTaskException- Parameters:
consumer-Consumerto set listeners before the Future is queued.- Returns:
Future- Throws:
CannotQueueTaskException
-
queue
Description copied from interface:Task -
queueAndSetBeforeExecutionListener
@NotNull default @NotNull Future<R,S> queueAndSetBeforeExecutionListener(@NotNull @NotNull Consumer<Future<R, S>> consumer) -
queue
-
queue
-
queue
-
queueAndWait
Description copied from interface:Task- Specified by:
queueAndWaitin interfaceTask<R,S> - Returns:
Taskresult- Throws:
InterruptedException- if interrupted while waitingErrorException- if theFuturereturned with an error.
-
queueAndWriteToFile
@NotNull default @NotNull Future<R,S> queueAndWriteToFile(@NotNull @NotNull Path file, boolean overwriteIfExists, @Nullable @Nullable ResultAndErrorConsumer<R, S> after) Description copied from interface:TaskWhat exactly will be written to the file, depends on the implementation.- Specified by:
queueAndWriteToFilein interfaceTask<R,S> - Parameters:
file-Pathof the file to write to.overwriteIfExists- if the file should be overwritten if it already exists.after-ResultAndErrorConsumerto consume the result after it has been written to the file.- Returns:
Future
-