Package com.naver.ads.util
Class MultiTaskHandler
-
- All Implemented Interfaces:
public abstract class MultiTaskHandlerHelper class for handling multiple asynchronous tasks.
-
-
Field Summary
Fields Modifier and Type Field Description private final AtomicIntegertasksLeftprivate final Booleancompleted
-
Constructor Summary
Constructors Constructor Description MultiTaskHandler(Integer numOfTasks)
-
Method Summary
Modifier and Type Method Description final AtomicIntegergetTasksLeft()the number of incomplete tasks. final BooleangetCompleted()final UnittaskCompleted()The function that should be called when the task completes final UnittaskFailed(String errorMessage)The function to call when an error occurs in the task abstract UnitonAllTasksCompleted()Called when all tasks have completed without error. abstract UnitonCompletedByError(String errorMessage)Called when the task is completed by an error. -
-
Constructor Detail
-
MultiTaskHandler
MultiTaskHandler(Integer numOfTasks)
- Parameters:
numOfTasks- the number of tasks.
-
-
Method Detail
-
getTasksLeft
final AtomicInteger getTasksLeft()
the number of incomplete tasks.
-
getCompleted
final Boolean getCompleted()
-
taskCompleted
final Unit taskCompleted()
The function that should be called when the task completes
-
taskFailed
final Unit taskFailed(String errorMessage)
The function to call when an error occurs in the task
-
onAllTasksCompleted
abstract Unit onAllTasksCompleted()
Called when all tasks have completed without error.
-
onCompletedByError
abstract Unit onCompletedByError(String errorMessage)
Called when the task is completed by an error.
-
-
-
-