Class ResultLongOperation<RESULT>
- java.lang.Object
-
- com.hybris.cockpitng.engine.operations.LongOperation
-
- com.hybris.cockpitng.engine.operations.ResultLongOperation<RESULT>
-
- Type Parameters:
RESULT- type of the result.
- All Implemented Interfaces:
Cancellable,java.lang.Runnable
public abstract class ResultLongOperation<RESULT> extends LongOperation
Executes operation with a result in background thread.
-
-
Constructor Summary
Constructors Constructor Description ResultLongOperation(CockpitThreadContextCreator cockpitThreadContextCreator)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidexecute()asynchronous callback for your long operation codeprotected abstract RESULTgetResult()Background operation which returns a result.protected voidonFinish()Callback method which is executed in Ui thread after long operation finishes.protected abstract voidonResult(RESULT result)Foreground operation which is called with result from background operationgetResult()-
Methods inherited from class com.hybris.cockpitng.engine.operations.LongOperation
activate, cancel, checkCancelled, deactivate, isCancelled, onCancel, onCleanup, onException, run, start
-
-
-
-
Constructor Detail
-
ResultLongOperation
public ResultLongOperation(CockpitThreadContextCreator cockpitThreadContextCreator)
- Parameters:
cockpitThreadContextCreator- util used to copy ctx from ui thread to background thread.
-
-
Method Detail
-
getResult
protected abstract RESULT getResult() throws java.lang.InterruptedException
Background operation which returns a result.- Returns:
- result of background operation.
- Throws:
java.lang.InterruptedException
-
onResult
protected abstract void onResult(RESULT result)
Foreground operation which is called with result from background operationgetResult()- Parameters:
result- result of the operation.
-
execute
protected void execute() throws java.lang.InterruptedExceptionDescription copied from class:LongOperationasynchronous callback for your long operation code- Specified by:
executein classLongOperation- Throws:
java.lang.InterruptedException- if operation has been Interrupted
-
onFinish
protected final void onFinish()
Description copied from class:LongOperationCallback method which is executed in Ui thread after long operation finishes.- Overrides:
onFinishin classLongOperation
-
-