Class 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 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 operation getResult()
        Parameters:
        result - result of the operation.
      • execute

        protected void execute()
                        throws java.lang.InterruptedException
        Description copied from class: LongOperation
        asynchronous callback for your long operation code
        Specified by:
        execute in class LongOperation
        Throws:
        java.lang.InterruptedException - if operation has been Interrupted
      • onFinish

        protected final void onFinish()
        Description copied from class: LongOperation
        Callback method which is executed in Ui thread after long operation finishes.
        Overrides:
        onFinish in class LongOperation