Package com.hybris.cockpitng.lazyloading
Class DefaultLazyTask<LAZY_DATA>
- java.lang.Object
-
- com.hybris.cockpitng.lazyloading.DefaultLazyTask<LAZY_DATA>
-
- Type Parameters:
LAZY_DATA- type of lazy task's result
- All Implemented Interfaces:
LazyTask
public class DefaultLazyTask<LAZY_DATA> extends java.lang.Object implements LazyTask
Class which collects lazy task, its result and consumer of task result Methods of this class must be called in special order: 1. executeTask 2. executeOnDoneIf the order is reversed, an exception will be thrown.
-
-
Constructor Summary
Constructors Constructor Description DefaultLazyTask(java.util.function.Supplier<LAZY_DATA> dataSupplier, java.util.function.Consumer<LazyTaskResult<LAZY_DATA>> dataConsumer)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidexecuteOnDone()Executes callback.voidexecuteTask()Method for executing task.
-
-
-
Constructor Detail
-
DefaultLazyTask
public DefaultLazyTask(java.util.function.Supplier<LAZY_DATA> dataSupplier, java.util.function.Consumer<LazyTaskResult<LAZY_DATA>> dataConsumer)
-
-
Method Detail
-
executeTask
public void executeTask()
Description copied from interface:LazyTaskMethod for executing task. Execution lasts much time usually.- Specified by:
executeTaskin interfaceLazyTask
-
executeOnDone
public void executeOnDone()
Description copied from interface:LazyTaskExecutes callback. Should be called when executeTask method is finished- Specified by:
executeOnDonein interfaceLazyTask
-
-