Java Code Examples for scala.concurrent.Promise#apply()

The following examples show how to use scala.concurrent.Promise#apply() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ScalaFutureBenchmark.java    From future with Apache License 2.0 5 votes vote down vote up
@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);
}
 
Example 2
Source File: ScalaFutureBenchmark.java    From future with Apache License 2.0 5 votes vote down vote up
@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);
}
 
Example 3
Source File: ScalaFutureBenchmark.java    From future with Apache License 2.0 5 votes vote down vote up
@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);
}
 
Example 4
Source File: ScalaFutureBenchmark.java    From future with Apache License 2.0 5 votes vote down vote up
@Benchmark
public Void ensurePromise() throws Exception {
  Promise<Void> p = Promise.<Void>apply();
  Future<Void> f = p.future().transform(ensureF, ec);
  p.success(null);
  return Await.result(f, inf);
}
 
Example 5
Source File: ScalaFutureBenchmark.java    From future with Apache License 2.0 5 votes vote down vote up
@Benchmark
public String flatMapPromiseN() throws Exception {
  Promise<String> p = Promise.<String>apply();
  Future<String> f = p.future();
  for (int i = 0; i < N.n; i++)
    f = f.flatMap(flatMapF, ec);
  p.success(string);
  return Await.result(f, inf);
}
 
Example 6
Source File: ScalaFutureBenchmark.java    From future with Apache License 2.0 5 votes vote down vote up
@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);
}
 
Example 7
Source File: ScalaFutureBenchmark.java    From future with Apache License 2.0 5 votes vote down vote up
@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);
}
 
Example 8
Source File: ScalaFutureBenchmark.java    From future with Apache License 2.0 5 votes vote down vote up
@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);
}
 
Example 9
Source File: ScalaFutureBenchmark.java    From future with Apache License 2.0 5 votes vote down vote up
@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);
}
 
Example 10
Source File: ScalaFutureBenchmark.java    From future with Apache License 2.0 5 votes vote down vote up
@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);
}
 
Example 11
Source File: ScalaFutureBenchmark.java    From future with Apache License 2.0 5 votes vote down vote up
@Benchmark
public Void ensurePromise() throws Exception {
  Promise<Void> p = Promise.<Void>apply();
  Future<Void> f = p.future().transform(ensureF, ec);
  p.success(null);
  return Await.result(f, inf);
}
 
Example 12
Source File: ScalaFutureBenchmark.java    From future with Apache License 2.0 5 votes vote down vote up
@Benchmark
public String flatMapPromiseN() throws Exception {
  Promise<String> p = Promise.<String>apply();
  Future<String> f = p.future();
  for (int i = 0; i < N.n; i++)
    f = f.flatMap(flatMapF, ec);
  p.success(string);
  return Await.result(f, inf);
}
 
Example 13
Source File: ScalaFutureBenchmark.java    From future with Apache License 2.0 5 votes vote down vote up
@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);
}
 
Example 14
Source File: ScalaFutureBenchmark.java    From future with Apache License 2.0 5 votes vote down vote up
@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);
}
 
Example 15
Source File: ScalaFutureBenchmark.java    From future with Apache License 2.0 4 votes vote down vote up
@Benchmark
public Promise<String> newPromise() {
  return Promise.<String>apply();
}
 
Example 16
Source File: ScalaFutureBenchmark.java    From future with Apache License 2.0 4 votes vote down vote up
@Benchmark
public String setValue() throws Exception {
  Promise<String> p = Promise.<String>apply();
  p.success(string);
  return Await.result(p.future(), inf);
}
 
Example 17
Source File: ScalaFutureBenchmark.java    From future with Apache License 2.0 4 votes vote down vote up
@Benchmark
public String setValue() throws Exception {
  Promise<String> p = Promise.<String>apply();
  p.success(string);
  return Await.result(p.future(), inf);
}
 
Example 18
Source File: ScalaFutureBenchmark.java    From future with Apache License 2.0 4 votes vote down vote up
@Benchmark
public Promise<String> newPromise() {
  return Promise.<String>apply();
}