public synchronized void loadValue ( final ARG_TYPE arg ) { if ( fetchFuture != null ) { // Cancel thread if it was not yet starter. fetchFuture . cancel ( false ) ; // If thread was cancelled before it was started inform error listeners. if ( fetchThread != null ) { fetchThread . interruptAndInformListenersIfNeeded ( ) ; } } // We use thread instead of pure runnable so we can interrupt loading. fetchThread = new LoadThread < RETURN_TYPE , ARG_TYPE > ( valueGetter , successListener , errorListener , value , arg , dropValueOnFailure ) ; fetchFuture = valueGetterExecutor . submit ( fetchThread ) ; }
Loads value in separate thread .