retrofit2.Call.isCanceled()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(4.7k)|赞(0)|评价(0)|浏览(169)

本文整理了Java中retrofit2.Call.isCanceled()方法的一些代码示例,展示了Call.isCanceled()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Call.isCanceled()方法的具体详情如下:
包路径:retrofit2.Call
类名称:Call
方法名:isCanceled

Call.isCanceled介绍

[英]True if #cancel() was called.
[中]如果调用了#cancel(),则为True。

代码示例

代码示例来源:origin: square/retrofit

@Override public boolean isCanceled() {
 return delegate.isCanceled();
}

代码示例来源:origin: resilience4j/resilience4j

@Override
public boolean isCanceled() {
  return call.isCanceled();
}

代码示例来源:origin: com.squareup.retrofit2/retrofit

@Override public boolean isCanceled() {
 return delegate.isCanceled();
}

代码示例来源:origin: square/retrofit

@Override public boolean isCanceled() {
 return getDelegate().isCanceled();
}

代码示例来源:origin: square/retrofit

@Override public void onFailure(Call<T> call, Throwable t) {
 if (call.isCanceled()) return;
 try {
  observer.onError(t);
 } catch (Throwable inner) {
  Exceptions.throwIfFatal(inner);
  RxJavaPlugins.onError(new CompositeException(t, inner));
 }
}

代码示例来源:origin: resilience4j/resilience4j

@Test
public void passThroughCallsToDecoratedObject() throws IOException {
  final Call<String> call = mock(StringCall.class);
  final Call<String> decorated = new DecoratedCall<>(call);
  decorated.cancel();
  Mockito.verify(call).cancel();
  decorated.enqueue(null);
  Mockito.verify(call).enqueue(any());
  decorated.isExecuted();
  Mockito.verify(call).isExecuted();
  decorated.isCanceled();
  Mockito.verify(call).isCanceled();
  decorated.clone();
  Mockito.verify(call).clone();
  decorated.request();
  Mockito.verify(call).request();
  decorated.execute();
  Mockito.verify(call).execute();
}

代码示例来源:origin: TakWolf/CNode-Material-Design

@Override
public void onCancel(DialogInterface dialog) {
  if (!call.isCanceled()) {
    call.cancel();
  }
}

代码示例来源:origin: TakWolf/CNode-Material-Design

private void cancelRefreshCall() {
  if (refreshCall != null) {
    if (!refreshCall.isCanceled()) {
      refreshCall.cancel();
    }
    refreshCall = null;
  }
}

代码示例来源:origin: TakWolf/CNode-Material-Design

private void cancelLoadMoreCall() {
  if (loadMoreCall != null) {
    if (!loadMoreCall.isCanceled()) {
      loadMoreCall.cancel();
    }
    loadMoreCall = null;
  }
}

代码示例来源:origin: TakWolf/CNode-Material-Design

@Override
public final void onFailure(@NonNull Call<T> call, @NonNull Throwable t) {
  boolean interrupt;
  if (call.isCanceled()) {
    interrupt = onCallCancel();
  } else {
    interrupt = onCallException(t, ErrorResult.from(t));
  }
  if (!interrupt) {
    onFinish();
  }
}

代码示例来源:origin: TakWolf/CNode-Material-Design

@Override
public final void onFailure(@NonNull Call<T> call, @NonNull Throwable t) {
  Activity activity = getActivity();
  if (ActivityUtils.isAlive(activity)) {
    boolean interrupt;
    if (call.isCanceled()) {
      interrupt = onCallCancel();
    } else {
      interrupt = onCallException(t, ErrorResult.from(t));
    }
    if (!interrupt) {
      onFinish();
    }
  }
}

代码示例来源:origin: TUM-Dev/Campus-Android

@Override
  public void onFailure(@NonNull Call<List<RoomFinderMap>> call,
             @NonNull Throwable throwable) {
    if (call.isCanceled()) {
      return;
    }
    onMapListLoadFailed();
    mRoomFinderMapsCall = null;
  }
});

代码示例来源:origin: TUM-Dev/Campus-Android

@Override
  public void onFailure(@NonNull Call<IdentitySet> call, @NonNull Throwable t) {
    if (call.isCanceled()) {
      return;
    }
    handleDownloadFailure(t);
    mIdentityCall = null;
  }
});

代码示例来源:origin: TUM-Dev/Campus-Android

@Override
  public void onFailure(@NonNull Call<AccessToken> call, @NonNull Throwable t) {
    if (call.isCanceled()) {
      return;
    }
    Utils.log(t);
    showLoadingEnded();
    resetAccessToken();
    displayErrorDialog(t);
    mTokenRequestCall = null;
  }
});

代码示例来源:origin: cemrich/zapp

@Override
public void onFailure(@NonNull Call<ShowResponse> call, @NonNull Throwable t) {
  if (!call.isCanceled()) {
    listener.onRequestError();
  }
}

代码示例来源:origin: com.pubnub/pubnub-gson

/**
 * cancel the operation but do not alert anybody, useful for restarting the heartbeats and subscribe loops.
 */
public void silentCancel() {
  if (call != null && !call.isCanceled()) {
    this.silenceFailures = true;
    call.cancel();
  }
}

代码示例来源:origin: leonardoxh/livedata-call-adapter

@SuppressWarnings("unchecked")
  @Override
  public void onFailure(Call<T> call, Throwable t) {
    if (call.isCanceled()) return;
    liveData.postValue(Resource.error(t));
  }
}

代码示例来源:origin: leonardoxh/livedata-call-adapter

@Override
public void onResponse(Call<T> call, Response<T> response) {
  if (call.isCanceled()) return;
  liveData.postValue(Response.success(Resource.success(response.body())));
}

代码示例来源:origin: leonardoxh/livedata-call-adapter

@SuppressWarnings("unchecked")
  @Override
  public void onFailure(Call<T> call, Throwable t) {
    if (call.isCanceled()) return;
    liveData.postValue(Response.<Resource<T>>success(Resource.error(t)));
  }
}

代码示例来源:origin: leonardoxh/livedata-call-adapter

@SuppressWarnings("unchecked")
@Override
public void onResponse(Call<T> call, Response<T> response) {
  if (call.isCanceled()) return;
  if (response.isSuccessful()) {
    liveData.postValue(Resource.success(response.body()));
  } else {
    liveData.postValue(Resource.error(new HttpException(response)));
  }
}

相关文章