rx.Single.toCompletable()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(8.9k)|赞(0)|评价(0)|浏览(83)

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

Single.toCompletable介绍

暂无

代码示例

代码示例来源:origin: spring-projects/spring-framework

@PostMapping("/single")
public Completable createWithSingle(@RequestBody Single<Person> single) {
  return single.map(persons::add).toCompletable();
}

代码示例来源:origin: vert-x3/vertx-examples

conn
 .rxExecute(sql).toCompletable()

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

@Override
 public Completable unpublish(ServiceDiscovery discovery) {
  return discovery.rxUnpublish(registrationId).toCompletable();
 }
}

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

private Completable ensureMapping() {
 // merge mappings from all indexers
 Map<String, Object> mappings = new HashMap<>();
 indexerFactories.stream().filter(f -> f instanceof DefaultMetaIndexerFactory)
  .forEach(factory -> MapUtils.deepMerge(mappings, factory.getMapping()));
 indexerFactories.stream().filter(f -> !(f instanceof DefaultMetaIndexerFactory))
  .forEach(factory -> MapUtils.deepMerge(mappings, factory.getMapping()));
 return client.putMapping(TYPE_NAME, new JsonObject(mappings)).toCompletable();
}

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

private Completable ensureMapping() {
 // merge mappings from all indexers
 Map<String, Object> mappings = new HashMap<>();
 indexerFactories.stream().filter(f -> f instanceof DefaultMetaIndexerFactory)
   .forEach(factory -> MapUtils.deepMerge(mappings, factory.getMapping()));
 indexerFactories.stream().filter(f -> !(f instanceof DefaultMetaIndexerFactory))
   .forEach(factory -> MapUtils.deepMerge(mappings, factory.getMapping()));
 return client.putMapping(TYPE_NAME, new JsonObject(mappings)).toCompletable();
}

代码示例来源:origin: io.vertx/vertx-rx-java

@Override
 public Observable<T> call(Observable<T> upstream) {
  return sqlConnection.rxSetAutoCommit(false).toCompletable()
   .andThen(upstream)
   .concatWith(sqlConnection.rxCommit().toCompletable().toObservable())
   .onErrorResumeNext(throwable -> {
    return sqlConnection.rxRollback().toCompletable().onErrorComplete()
     .andThen(sqlConnection.rxSetAutoCommit(true).toCompletable().onErrorComplete())
     .andThen(Observable.error(throwable));
   }).concatWith(sqlConnection.rxSetAutoCommit(true).toCompletable().toObservable());
 }
}

代码示例来源:origin: vert-x3/vertx-rx

@Override
 public Observable<T> call(Observable<T> upstream) {
  return sqlConnection.rxSetAutoCommit(false).toCompletable()
   .andThen(upstream)
   .concatWith(sqlConnection.rxCommit().toCompletable().toObservable())
   .onErrorResumeNext(throwable -> {
    return sqlConnection.rxRollback().toCompletable().onErrorComplete()
     .andThen(sqlConnection.rxSetAutoCommit(true).toCompletable().onErrorComplete())
     .andThen(Observable.error(throwable));
   }).concatWith(sqlConnection.rxSetAutoCommit(true).toCompletable().toObservable());
 }
}

代码示例来源:origin: io.vertx/vertx-rx-java

@Override
 public Completable call(Completable upstream) {
  return sqlConnection.rxSetAutoCommit(false).toCompletable()
   .andThen(upstream)
   .andThen(sqlConnection.rxCommit().toCompletable())
   .onErrorResumeNext(throwable -> {
    return sqlConnection.rxRollback().toCompletable().onErrorComplete()
     .andThen(sqlConnection.rxSetAutoCommit(true).toCompletable().onErrorComplete())
     .andThen(Completable.error(throwable));
   }).andThen(sqlConnection.rxSetAutoCommit(true).toCompletable());
 }
}

代码示例来源:origin: vert-x3/vertx-rx

@Override
 public Completable call(Completable upstream) {
  return sqlConnection.rxSetAutoCommit(false).toCompletable()
   .andThen(upstream)
   .andThen(sqlConnection.rxCommit().toCompletable())
   .onErrorResumeNext(throwable -> {
    return sqlConnection.rxRollback().toCompletable().onErrorComplete()
     .andThen(sqlConnection.rxSetAutoCommit(true).toCompletable().onErrorComplete())
     .andThen(Completable.error(throwable));
   }).andThen(sqlConnection.rxSetAutoCommit(true).toCompletable());
 }
}

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

/**
 * Rx version of {@link #delete(String, String, DeleteMeta, Handler)}
 * @param search the search query
 * @param path the path where to search for the chunks (may be null)
 * @param deleteMeta a metadata object containing additional information
 * about the deletion process
 * @return a Completable that completes when the operation has finished
 */
public Completable rxDelete(String search, String path, DeleteMeta deleteMeta) {
 return Single.create(new SingleOnSubscribeAdapter<Void>(f ->
  delete(search, path, deleteMeta, f))).toCompletable();
}

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

/**
 * Rx version of {@link #appendTags(String, String, List, Handler)}
 * @param search the search query
 * @param path the path where to search for the values (may be null)
 * @param tags the list of tags to append
 * @return a Completable that completes when the operation has finished
 */
public Completable rxAppendTags(String search, String path, List<String> tags) {
 return Single.create(new SingleOnSubscribeAdapter<Void>(f ->
   appendTags(search, path, tags, f))).toCompletable();
}

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

/**
 * Rx version of {@link #setProperties(String, String, Map, Handler)}
 * @param search the search query
 * @param path the path where to search for the values (may be null)
 * @param properties the list of properties to set
 * @return a Completable that completes when the operation has finished
 */
public Completable rxSetProperties(String search, String path,
  Map<String, String> properties) {
 return Single.create(new SingleOnSubscribeAdapter<Void>(f ->
   setProperties(search, path, properties, f))).toCompletable();
}

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

/**
 * Rx version of {@link #removeProperties(String, String, List, Handler)}
 * @param search the search query
 * @param path the path where to search for the values (may be null)
 * @param properties the list of properties to remove
 * @return a Completable that completes when the operation has finished
 */
public Completable rxRemoveProperties(String search, String path,
  List<String> properties) {
 return Single.create(new SingleOnSubscribeAdapter<Void>(f ->
   removeProperties(search, path, properties, f))).toCompletable();
}

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

/**
  * Rx version of {@link #removeTags(String, String, List, Handler)}
  * @param search the search query
  * @param path the path where to search for the values (may be null)
  * @param tags the list of tags to remove
  * @return a Completable that completes when the operation has finished
  */
 public Completable rxRemoveTags(String search, String path, List<String> tags) {
  return Single.create(new SingleOnSubscribeAdapter<Void>(f ->
    removeTags(search, path, tags, f))).toCompletable();
 }
}

代码示例来源:origin: io.vertx/vertx-rx-java

@Override
 public Single<T> call(Single<T> upstream) {
  return sqlConnection.rxSetAutoCommit(false).toCompletable()
   .andThen(upstream)
   .flatMap(item -> sqlConnection.rxCommit().toCompletable().andThen(Single.just(item)))
   .onErrorResumeNext(throwable -> {
    return sqlConnection.rxRollback().toCompletable().onErrorComplete()
     .andThen(sqlConnection.rxSetAutoCommit(true).toCompletable().onErrorComplete())
     .andThen(Single.error(throwable));
   }).flatMap(item -> sqlConnection.rxSetAutoCommit(true).toCompletable().andThen(Single.just(item)));
 }
}

代码示例来源:origin: vert-x3/vertx-rx

@Override
 public Single<T> call(Single<T> upstream) {
  return sqlConnection.rxSetAutoCommit(false).toCompletable()
   .andThen(upstream)
   .flatMap(item -> sqlConnection.rxCommit().toCompletable().andThen(Single.just(item)))
   .onErrorResumeNext(throwable -> {
    return sqlConnection.rxRollback().toCompletable().onErrorComplete()
     .andThen(sqlConnection.rxSetAutoCommit(true).toCompletable().onErrorComplete())
     .andThen(Single.error(throwable));
   }).flatMap(item -> sqlConnection.rxSetAutoCommit(true).toCompletable().andThen(Single.just(item)));
 }
}

代码示例来源:origin: vert-x3/vertx-rx

protected Completable rxInsertExtraFolks(SQLConnection conn) {
 return conn.rxExecute(String.format(INSERT_FOLK_SQL, "Georges")).toCompletable()
  .andThen(conn.rxExecute(String.format(INSERT_FOLK_SQL, "Henry")).toCompletable());
}

代码示例来源:origin: vert-x3/vertx-rx

@Override
 public void tearDown() throws Exception {
  client.rxClose().toCompletable().await();
 }
}

代码示例来源:origin: hawkular/hawkular-metrics

private Completable doPostJobExecutionWithoutRescheduling(Completable job, JobDetailsImpl jobDetails,
    Date timeSlice, Set<UUID> activeJobs) {
  return job
      .toSingle(() -> new JobExecutionState(jobDetails, activeJobs))
      .flatMap(this::releaseJobExecutionLock)
      .flatMap(this::setJobFinished)
      .doOnError(t -> {
        logger.debug("There was an error during post-job execution, but the job has already been " +
            "rescheduled.", t);
        publishJobFinished(jobDetails);
      })
      .doOnSuccess(states -> publishJobFinished(states.currentDetails))
      .toCompletable();
}

代码示例来源:origin: vert-x3/vertx-rx

@Override
public void setUp() throws Exception {
 super.setUp();
 client = new JDBCClient(io.vertx.ext.jdbc.JDBCClient.createNonShared(vertx, config));
 client.rxGetConnection().flatMapCompletable(conn -> {
  Completable setup = conn.rxExecute("drop table folks if exists").toCompletable()
   .andThen(conn.rxExecute("create table folks (firstname varchar(255) not null)").toCompletable());
  for (String name : NAMES) {
   setup = setup.andThen(conn.rxExecute(String.format(INSERT_FOLK_SQL, name)).toCompletable());
  }
  return setup.doAfterTerminate(conn::close);
 }).await();
}

相关文章