本文整理汇总了Java中com.lzy.okgo.adapter.Call.execute方法的典型用法代码示例。如果您正苦于以下问题:Java Call.execute方法的具体用法?Java Call.execute怎么用?Java Call.execute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.lzy.okgo.adapter.Call
的用法示例。
在下文中一共展示了Call.execute方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: subscribeActual
import com.lzy.okgo.adapter.Call; //导入方法依赖的package包/类
@Override
protected void subscribeActual(Observer<? super Response<T>> observer) {
// Since Call is a one-shot type, clone it for each new observer.
Call<T> call = originalCall.clone();
observer.onSubscribe(new CallDisposable(call));
boolean terminated = false;
try {
Response<T> response = call.execute();
if (!call.isCanceled()) {
observer.onNext(response);
}
if (!call.isCanceled()) {
terminated = true;
observer.onComplete();
}
} catch (Throwable t) {
Exceptions.throwIfFatal(t);
if (terminated) {
RxJavaPlugins.onError(t);
} else if (!call.isCanceled()) {
try {
observer.onError(t);
} catch (Throwable inner) {
Exceptions.throwIfFatal(inner);
RxJavaPlugins.onError(new CompositeException(t, inner));
}
}
}
}
示例2: subscribeActual
import com.lzy.okgo.adapter.Call; //导入方法依赖的package包/类
@Override
protected void subscribeActual(Observer<? super Response<T>> observer) {
// Since Call is a one-shot type, clone it for each new observer.
Call<T> call = originalCall.clone();
CallCallback<T> callback = new CallCallback<>(call, observer);
observer.onSubscribe(callback);
call.execute(callback);
}
示例3: execute
import com.lzy.okgo.adapter.Call; //导入方法依赖的package包/类
/** 非阻塞方法,异步请求,但是回调在子线程中执行 */
public void execute(Callback<T> callback) {
HttpUtils.checkNotNull(callback, "callback == null");
this.callback = callback;
Call<T> call = adapt();
call.execute(callback);
}