本文整理汇总了Java中scala.concurrent.Promise.apply方法的典型用法代码示例。如果您正苦于以下问题:Java Promise.apply方法的具体用法?Java Promise.apply怎么用?Java Promise.apply使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类scala.concurrent.Promise
的用法示例。
在下文中一共展示了Promise.apply方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: mapPromise
import scala.concurrent.Promise; //导入方法依赖的package包/类
@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);
}
示例2: mapPromiseN
import scala.concurrent.Promise; //导入方法依赖的package包/类
@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);
}
示例3: flatMapPromise
import scala.concurrent.Promise; //导入方法依赖的package包/类
@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);
}
示例4: flatMapPromiseN
import scala.concurrent.Promise; //导入方法依赖的package包/类
@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);
}
示例5: ensurePromise
import scala.concurrent.Promise; //导入方法依赖的package包/类
@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);
}
示例6: ensurePromiseN
import scala.concurrent.Promise; //导入方法依赖的package包/类
@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);
}
示例7: setValueN
import scala.concurrent.Promise; //导入方法依赖的package包/类
@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);
}
示例8: newPromise
import scala.concurrent.Promise; //导入方法依赖的package包/类
@Benchmark
public Promise<String> newPromise() {
return Promise.<String>apply();
}
示例9: setValue
import scala.concurrent.Promise; //导入方法依赖的package包/类
@Benchmark
public String setValue() throws Exception {
Promise<String> p = Promise.<String>apply();
p.success(string);
return Await.result(p.future(), inf);
}