rx.Observable.mergeDelayError()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(11.6k)|赞(0)|评价(0)|浏览(152)

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

Observable.mergeDelayError介绍

[英]Flattens an Observable that emits Observables into one Observable, in a way that allows an Observer to receive all successfully emitted items from all of the source Observables without being interrupted by an error notification from one of them.

This behaves like #merge(Observable) except that if any of the merged Observables notify of an error via Observer#onError, mergeDelayError will refrain from propagating that error notification until all of the merged Observables have finished emitting items.

Even if multiple merged Observables send onError notifications, mergeDelayError will only invoke the onError method of its Observers once. Scheduler: mergeDelayError does not operate by default on a particular Scheduler.
[中]将发射可观测值的可观测值展平为一个可观测值,使观察者能够从所有源可观测值接收所有成功发射的项目,而不会被其中一个源可观测值的错误通知打断。
其行为类似于#合并(可观察),但如果任何合并的可观察对象通过Observer#OneError通知错误,mergeDelayError将在所有合并的可观察对象完成发射项目之前避免传播该错误通知。
即使多个合并的观察对象发送OneError通知,mergeDelayError也只会调用其观察者的OneError方法一次。调度程序:默认情况下,mergeDelayError不会在特定调度程序上运行。

代码示例

代码示例来源:origin: Netflix/servo

try {
 final CountDownLatch completed = new CountDownLatch(1);
 final Subscription s = Observable.mergeDelayError(Observable.from(batches))
   .timeout(timeoutMillis, TimeUnit.MILLISECONDS)
   .subscribeOn(Schedulers.immediate())

代码示例来源:origin: smuyyh/BookReader

Subscription rxSubscription = Observable.mergeDelayError(observables)
    .subscribeOn(Schedulers.io())
    .observeOn(AndroidSchedulers.mainThread())

代码示例来源:origin: com.microsoft.azure/azure-mgmt-servicebus

public Observable<String> deleteByNameAsync(List<String> names) {
  List<Observable<String>> items = new ArrayList<>();
  for (final String name : names) {
    items.add(this.deleteByNameAsync(name).<String>toObservable().map(new Func1<String, String>() {
      @Override
      public String call(String s) {
        return name;
      }
    }));
  }
  return Observable.mergeDelayError(items);
}

代码示例来源:origin: Azure/azure-libraries-for-java

public Observable<String> deleteByNameAsync(List<String> names) {
  List<Observable<String>> items = new ArrayList<>();
  for (final String name : names) {
    items.add(this.deleteByNameAsync(name).<String>toObservable().map(new Func1<String, String>() {
      @Override
      public String call(String s) {
        return name;
      }
    }));
  }
  return Observable.mergeDelayError(items);
}

代码示例来源:origin: gitskarios/GithubAndroidSdk

private Observable<List<IssueStoryDetail>> getIssueDetailsObservable() {
 Observable<IssueStoryDetail> commentsDetailsObs = getCommentsDetailsObs();
 Observable<IssueStoryDetail> eventDetailsObs = getEventDetailsObs();
 Observable<IssueStoryDetail> reviewCommentsObs = getReviewCommentsDetailsObs();
 Observable<IssueStoryDetail> details =
   Observable.mergeDelayError(eventDetailsObs, reviewCommentsObs);
 return Observable.mergeDelayError(commentsDetailsObs, details)
   .toSortedList((issueStoryDetail, issueStoryDetail2) -> {
    return ((Long) issueStoryDetail.createdAt()).compareTo(issueStoryDetail2.createdAt());
   });
}

代码示例来源:origin: gitskarios/GithubAndroidSdk

private Observable<List<IssueStoryDetail>> getIssueDetailsObservable() {
  Observable<IssueStoryDetail> commentsDetailsObs = getCommentsDetailsObs();
  Observable<IssueStoryDetail> eventDetailsObs = getEventDetailsObs();
  return Observable.mergeDelayError(commentsDetailsObs, eventDetailsObs).toList();
}

代码示例来源:origin: com.microsoft.azure.compute.v2017_03_30/azure-mgmt-compute

@Override
public Observable<String> deleteByIdsAsync(Collection<String> ids) {
  if (ids == null || ids.isEmpty()) {
    return Observable.empty();
  }
  Collection<Observable<String>> observables = new ArrayList<>();
  for (String id : ids) {
    final String resourceGroupName = ResourceUtilsCore.groupFromResourceId(id);
    final String name = ResourceUtilsCore.nameFromResourceId(id);
    Observable<String> o = RXMapper.map(this.inner().deleteAsync(resourceGroupName, name), id);
    observables.add(o);
  }
  return Observable.mergeDelayError(observables);
}

代码示例来源:origin: com.microsoft.azure.compute.v2017_03_30/azure-mgmt-compute

@Override
public Observable<String> deleteByIdsAsync(Collection<String> ids) {
  if (ids == null || ids.isEmpty()) {
    return Observable.empty();
  }
  Collection<Observable<String>> observables = new ArrayList<>();
  for (String id : ids) {
    final String resourceGroupName = ResourceUtilsCore.groupFromResourceId(id);
    final String name = ResourceUtilsCore.nameFromResourceId(id);
    Observable<String> o = RXMapper.map(this.inner().deleteAsync(resourceGroupName, name), id);
    observables.add(o);
  }
  return Observable.mergeDelayError(observables);
}

代码示例来源:origin: com.microsoft.azure.compute.v2017_03_30/azure-mgmt-compute

@Override
public Observable<String> deleteByIdsAsync(Collection<String> ids) {
  if (ids == null || ids.isEmpty()) {
    return Observable.empty();
  }
  Collection<Observable<String>> observables = new ArrayList<>();
  for (String id : ids) {
    final String resourceGroupName = ResourceUtilsCore.groupFromResourceId(id);
    final String name = ResourceUtilsCore.nameFromResourceId(id);
    Observable<String> o = RXMapper.map(this.inner().deleteAsync(resourceGroupName, name), id);
    observables.add(o);
  }
  return Observable.mergeDelayError(observables);
}

代码示例来源:origin: com.microsoft.azure/azure-mgmt-resources

@Override
public Observable<String> deleteByIdsAsync(Collection<String> ids) {
  if (ids == null || ids.isEmpty()) {
    return Observable.empty();
  }
  Collection<Observable<String>> observables = new ArrayList<>();
  for (String id : ids) {
    final String resourceGroupName = ResourceUtils.groupFromResourceId(id);
    final String name = ResourceUtils.nameFromResourceId(id);
    Observable<String> o = RXMapper.map(this.inner().deleteAsync(resourceGroupName, name), id);
    observables.add(o);
  }
  return Observable.mergeDelayError(observables);
}

代码示例来源:origin: com.microsoft.azure/azure-mgmt-compute

@Override
public Observable<String> deleteByIdsAsync(Collection<String> ids) {
  if (ids == null || ids.isEmpty()) {
    return Observable.empty();
  }
  Collection<Observable<String>> observables = new ArrayList<>();
  for (String id : ids) {
    final String resourceGroupName = ResourceUtils.groupFromResourceId(id);
    final String name = ResourceUtils.nameFromResourceId(id);
    Observable<String> o = RXMapper.map(this.inner().deleteAsync(resourceGroupName, name), id);
    observables.add(o);
  }
  return Observable.mergeDelayError(observables);
}

代码示例来源:origin: com.microsoft.azure.appservice.v2016_03_01/azure-mgmt-appservice

@Override
public Observable<String> deleteByIdsAsync(Collection<String> ids) {
  if (ids == null || ids.isEmpty()) {
    return Observable.empty();
  }
  Collection<Observable<String>> observables = new ArrayList<>();
  for (String id : ids) {
    final String resourceGroupName = ResourceUtilsCore.groupFromResourceId(id);
    final String name = ResourceUtilsCore.nameFromResourceId(id);
    Observable<String> o = RXMapper.map(this.inner().deleteAsync(resourceGroupName, name), id);
    observables.add(o);
  }
  return Observable.mergeDelayError(observables);
}

代码示例来源:origin: com.microsoft.azure.compute.v2017_03_30/azure-mgmt-compute

@Override
public Observable<String> deleteByIdsAsync(Collection<String> ids) {
  if (ids == null || ids.isEmpty()) {
    return Observable.empty();
  }
  Collection<Observable<String>> observables = new ArrayList<>();
  for (String id : ids) {
    final String resourceGroupName = ResourceUtilsCore.groupFromResourceId(id);
    final String name = ResourceUtilsCore.nameFromResourceId(id);
    Observable<String> o = RXMapper.map(this.inner().deleteAsync(resourceGroupName, name), id);
    observables.add(o);
  }
  return Observable.mergeDelayError(observables);
}

代码示例来源:origin: com.microsoft.azure.locks.v2016_09_01/azure-mgmt-locks

@Override
public Observable<String> deleteByIdsAsync(Collection<String> ids) {
  if (ids == null || ids.isEmpty()) {
    return Observable.empty();
  }
  Collection<Observable<String>> observables = new ArrayList<>();
  for (String id : ids) {
    final String resourceGroupName = ResourceUtilsCore.groupFromResourceId(id);
    final String name = ResourceUtilsCore.nameFromResourceId(id);
    Observable<String> o = RXMapper.map(this.inner().deleteAtResourceGroupLevelAsync(resourceGroupName, name), id);
    observables.add(o);
  }
  return Observable.mergeDelayError(observables);
}

代码示例来源:origin: com.microsoft.azure.compute.v2017_03_30/azure-mgmt-compute

@Override
public Observable<String> deleteByIdsAsync(Collection<String> ids) {
  if (ids == null || ids.isEmpty()) {
    return Observable.empty();
  }
  Collection<Observable<String>> observables = new ArrayList<>();
  for (String id : ids) {
    final String resourceGroupName = ResourceUtilsCore.groupFromResourceId(id);
    final String name = ResourceUtilsCore.nameFromResourceId(id);
    Observable<String> o = RXMapper.map(this.inner().deleteAsync(resourceGroupName, name), id);
    observables.add(o);
  }
  return Observable.mergeDelayError(observables);
}

代码示例来源:origin: com.microsoft.azure.compute.v2017_03_30/azure-mgmt-compute

@Override
public Observable<String> deleteByIdsAsync(Collection<String> ids) {
  if (ids == null || ids.isEmpty()) {
    return Observable.empty();
  }
  Collection<Observable<String>> observables = new ArrayList<>();
  for (String id : ids) {
    final String resourceGroupName = ResourceUtilsCore.groupFromResourceId(id);
    final String name = ResourceUtilsCore.nameFromResourceId(id);
    Observable<String> o = RXMapper.map(this.inner().deleteAsync(resourceGroupName, name), id);
    observables.add(o);
  }
  return Observable.mergeDelayError(observables);
}

代码示例来源:origin: com.microsoft.azure/azure-mgmt-monitor

@Override
public Observable<String> deleteByIdsAsync(Collection<String> ids) {
  if (ids == null || ids.isEmpty()) {
    return Observable.empty();
  }
  Collection<Observable<String>> observables = new ArrayList<>();
  for (String id : ids) {
    final String resourceGroupName = getResourceIdFromSettingsId(id);
    final String name = getNameFromSettingsId(id);
    Observable<String> o = RXMapper.map(this.inner().deleteAsync(resourceGroupName, name), id);
    observables.add(o);
  }
  return Observable.mergeDelayError(observables);
}

代码示例来源:origin: com.microsoft.azure.resources.v2018_02_01/azure-mgmt-resources

@Override
public Observable<String> deleteByIdsAsync(Collection<String> ids) {
  if (ids == null || ids.isEmpty()) {
    return Observable.empty();
  }
  Collection<Observable<String>> observables = new ArrayList<>();
  for (String id : ids) {
    final String resourceGroupName = ResourceUtilsCore.groupFromResourceId(id);
    final String name = ResourceUtilsCore.nameFromResourceId(id);
    Observable<String> o = RXMapper.map(this.inner().deleteAsync(resourceGroupName, name), id);
    observables.add(o);
  }
  return Observable.mergeDelayError(observables);
}

代码示例来源:origin: Azure/azure-libraries-for-java

@Override
public Observable<String> deleteByIdsAsync(Collection<String> ids) {
  if (ids == null || ids.isEmpty()) {
    return Observable.empty();
  }
  Collection<Observable<String>> observables = new ArrayList<>();
  for (String id : ids) {
    final String resourceGroupName = getResourceIdFromSettingsId(id);
    final String name = getNameFromSettingsId(id);
    Observable<String> o = RXMapper.map(this.inner().deleteAsync(resourceGroupName, name), id);
    observables.add(o);
  }
  return Observable.mergeDelayError(observables);
}

代码示例来源:origin: com.microsoft.azure/azure-mgmt-network

@Override
public Observable<String> startAsync(Collection<String> applicationGatewayResourceIds) {
  if (applicationGatewayResourceIds == null) {
    return Observable.empty();
  }
  Collection<Observable<String>> observables = new ArrayList<>();
  for (String id : applicationGatewayResourceIds) {
    final String resourceGroupName = ResourceUtils.groupFromResourceId(id);
    final String name = ResourceUtils.nameFromResourceId(id);
    Observable<String> o = RXMapper.map(this.inner().startAsync(resourceGroupName, name), id);
    observables.add(o);
  }
  return Observable.mergeDelayError(observables);
}

相关文章

Observable类方法