@Override public Promise<V> onSuccessBlocking(SuccessListener<V> onSuccess) { addStateListener( (promise, state) -> { if (state.isDone() && state == PromiseState.Succeeded) { try { onSuccess.onSuccess(promise.getValue()); } catch (Throwable e) { log.error("Error thrown while calling success listener", e); } } }); return this; }
@Override public Promise<V> onSuccessAsync(SuccessListener<V> onSuccess) { addStateListener( (promise, state) -> { if (state.isDone() && state == PromiseState.Succeeded) { getFactory() .getAsyncExecutor() .execute( () -> { try { onSuccess.onSuccess(promise.getValue()); } catch (Throwable e) { log.error("Error thrown while calling success listener", e); } }); } }); return this; }