ProgressIndicator function ( @ NotNull Function < ProgressIndicator , Runnable > arg0 , @ Nullable Runnable arg1 , long arg2 ) { return executeAndTryWait ( arg0 , arg1 , arg2 , false ) ; }
executor to perform possibly long operation on pooled thread . if computation was performed within given time frame , the computed callback will be executed synchronously avoiding unnecessary invokelater . in this case , onslowaction will not be executed at all . if the computation is fast , execute callback synchronously . if the computation is slow , execute onslowaction synchronously . when the computation is completed , execute callback in edt . it can be used to reduce blinking when background task might be completed fast . a simple approach : onslowaction.run / / show `` loading ... '' executeonpooledthread runnable callback = backgroundtask ; / / some background computations invokelater callback ; / / apply changes ; will lead to `` loading ... '' visible between current moment and execution of invokelater event . this period can be very short and looks like ` jumping ' if background operation is fast . concode_field_sep AtomicReference<Object> myResultRef concode_elem_sep Object SLOW_OPERATION_STATE concode_elem_sep Logger LOG concode_elem_sep Semaphore mySemaphore concode_elem_sep Object INITIAL_STATE concode_field_sep boolean setResult concode_elem_sep T getResult concode_elem_sep boolean await concode_elem_sep void finish concode_elem_sep ProgressIndicator executeOnPooledThread concode_elem_sep ProgressIndicator executeOnPooledThread concode_elem_sep ProgressIndicator executeOnPooledThread concode_elem_sep T tryComputeFast concode_elem_sep T computeInBackgroundAndTryWait concode_elem_sep Pair<T,ProgressIndicator> computeInBackgroundAndTryWait