scala.concurrent.Promise.success()方法的使用及代码示例

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

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

Promise.success介绍

暂无

代码示例

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

@Override public void onResponse(Call<T> call, Response<T> response) {
 promise.success(response);
}

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

@Override public void onResponse(Call<T> call, Response<T> response) {
 if (response.isSuccessful()) {
  promise.success(response.body());
 } else {
  promise.failure(new HttpException(response));
 }
}

代码示例来源:origin: com.typesafe.play/play_2.10

/**
 * Completes the promise with a value.
 *
 * @param a The value to complete with
 */
public void success(A a) {
  this.promise.success(a);
}

代码示例来源:origin: org.apache.flink/flink-runtime_2.10

@Override
public boolean complete(T value) {
  try {
    promise.success(value);
    return true;
  } catch (IllegalStateException e) {
    return false;
  }
}

代码示例来源:origin: com.github.gitssie/play-transport

@Override
  public void onNext(HttpResponse o) {
    promise.success(o);
  }
});

代码示例来源:origin: org.apache.flink/flink-runtime

private void completePromise(ActorGateway gateway) {
  synchronized (lock) {
    if (!futureActorGateway.isCompleted()) {
      futureActorGateway.success(gateway);
    }
  }
}

代码示例来源:origin: com.typesafe.play/play-ahc-ws-standalone

@Override
public Response onCompleted(Response response) {
  StandaloneAhcWSResponse r = new StandaloneAhcWSResponse(response);
  scalaPromise.success(r);
  return response;
}

代码示例来源:origin: com.typesafe.play/play-ahc-ws-standalone_2.12

@Override
public Response onCompleted(Response response) {
  StandaloneAhcWSResponse r = new StandaloneAhcWSResponse(response);
  scalaPromise.success(r);
  return response;
}

代码示例来源:origin: org.apache.flink/flink-runtime_2.10

private void completePromise(ActorGateway gateway) {
  synchronized (lock) {
    if (!futureActorGateway.isCompleted()) {
      futureActorGateway.success(gateway);
    }
  }
}

代码示例来源:origin: com.typesafe.play/play-java-ws

@Override
public Response onCompleted(Response response) {
  scalaPromise.success(new AhcWSResponse(response));
  return response;
}

代码示例来源:origin: com.alibaba.blink/flink-runtime

private void completePromise(ActorGateway gateway) {
  synchronized (lock) {
    if (!futureActorGateway.isCompleted()) {
      futureActorGateway.success(gateway);
    }
  }
}

代码示例来源:origin: play/play-java

@Override
public com.ning.http.client.Response onCompleted(com.ning.http.client.Response response) {
  final com.ning.http.client.Response ahcResponse = response;
  scalaPromise.success(new Response(ahcResponse));
  return response;
}
@Override

代码示例来源:origin: opendaylight/controller

@Override
public void onSuccess(@Nonnull final YangTextSchemaSource result) {
  try {
    promise.success(new YangTextSchemaSourceSerializationProxy(result));
  } catch (IOException e) {
    LOG.warn("Unable to read schema source for {}", result.getIdentifier(), e);
    promise.failure(e);
  }
}

代码示例来源:origin: org.apache.flink/flink-runtime_2.11

@Override
public void notifyLeaderAddress(String leaderAddress, UUID leaderSessionID) {
  if (leaderAddress != null && !leaderAddress.equals("") && !connectionInfo.isCompleted()) {
    try {
      final LeaderConnectionInfo leaderConnectionInfo = new LeaderConnectionInfo(leaderAddress, leaderSessionID);
      connectionInfo.success(leaderConnectionInfo);
    } catch (FlinkException e) {
      connectionInfo.failure(e);
    }
  }
}

代码示例来源:origin: org.opendaylight.controller/sal-clustering-commons

@Override
public void onSuccess(YangTextSchemaSource result) {
  try {
    promise.success(new YangTextSchemaSourceSerializationProxy(result));
  } catch (IOException e) {
    LOG.warn("Unable to read schema source for {}", result.getIdentifier(), e);
    promise.failure(e);
  }
}

代码示例来源:origin: traneio/future

@Benchmark
public Void ensurePromiseN() throws Exception {
 Promise<Void> p = Promise.<Void>apply();
 Future<Void> f = p.future();
 for (int i = 0; i < N.n; i++)
  f = f.transform(ensureF, ec);
 p.success(null);
 return Await.result(f, inf);
}

代码示例来源:origin: traneio/future

@Benchmark
public String setValueN() throws Exception {
 Promise<String> p = Promise.<String>apply();
 Future<String> f = p.future();
 for (int i = 0; i < N.n; i++)
  f = f.map(mapF, ec);
 p.success(string);
 return Await.result(f, inf);
}

代码示例来源:origin: traneio/future

@Benchmark
public String mapPromise() throws Exception {
 Promise<String> p = Promise.<String>apply();
 Future<String> f = p.future().map(mapF, ec);
 p.success(string);
 return Await.result(f, inf);
}

代码示例来源:origin: traneio/future

@Benchmark
public String mapPromiseN() throws Exception {
 Promise<String> p = Promise.<String>apply();
 Future<String> f = p.future();
 for (int i = 0; i < N.n; i++)
  f = f.map(mapF, ec);
 p.success(string);
 return Await.result(f, inf);
}

代码示例来源:origin: traneio/future

@Benchmark
public String flatMapPromise() throws Exception {
 Promise<String> p = Promise.<String>apply();
 Future<String> f = p.future().flatMap(flatMapF, ec);
 p.success(string);
 return Await.result(f, inf);
}

相关文章