Removing ExecutionContext from some signatures in Future.scala, changing copyright to Akka for BatchingExecutor
This commit is contained in:
parent
f3078263bc
commit
94e8d201f0
3 changed files with 22 additions and 23 deletions
|
|
@ -64,7 +64,7 @@ public class JavaFutureTests {
|
|||
@Test
|
||||
public void mustBeAbleToExecuteAnOnResultCallback() throws Throwable {
|
||||
final CountDownLatch latch = new CountDownLatch(1);
|
||||
Promise<String> cf = Futures.promise(system.dispatcher());
|
||||
Promise<String> cf = Futures.promise();
|
||||
Future<String> f = cf.future();
|
||||
f.onSuccess(new OnSuccess<String>() {
|
||||
public void onSuccess(String result) {
|
||||
|
|
@ -81,7 +81,7 @@ public class JavaFutureTests {
|
|||
@Test
|
||||
public void mustBeAbleToExecuteAnOnExceptionCallback() throws Throwable {
|
||||
final CountDownLatch latch = new CountDownLatch(1);
|
||||
Promise<String> cf = Futures.promise(system.dispatcher());
|
||||
Promise<String> cf = Futures.promise();
|
||||
Future<String> f = cf.future();
|
||||
f.onFailure(new OnFailure() {
|
||||
public void onFailure(Throwable t) {
|
||||
|
|
@ -99,7 +99,7 @@ public class JavaFutureTests {
|
|||
@Test
|
||||
public void mustBeAbleToExecuteAnOnCompleteCallback() throws Throwable {
|
||||
final CountDownLatch latch = new CountDownLatch(1);
|
||||
Promise<String> cf = Futures.promise(system.dispatcher());
|
||||
Promise<String> cf = Futures.promise();
|
||||
Future<String> f = cf.future();
|
||||
f.onComplete(new OnComplete<String>() {
|
||||
public void onComplete(Throwable t, String r) {
|
||||
|
|
@ -115,7 +115,7 @@ public class JavaFutureTests {
|
|||
@Test
|
||||
public void mustBeAbleToForeachAFuture() throws Throwable {
|
||||
final CountDownLatch latch = new CountDownLatch(1);
|
||||
Promise<String> cf = Futures.promise(system.dispatcher());
|
||||
Promise<String> cf = Futures.promise();
|
||||
Future<String> f = cf.future();
|
||||
f.foreach(new Foreach<String>() {
|
||||
public void each(String future) {
|
||||
|
|
@ -131,14 +131,14 @@ public class JavaFutureTests {
|
|||
@Test
|
||||
public void mustBeAbleToFlatMapAFuture() throws Throwable {
|
||||
final CountDownLatch latch = new CountDownLatch(1);
|
||||
Promise<String> cf = Futures.promise(system.dispatcher());
|
||||
Promise<String> cf = Futures.promise();
|
||||
cf.success("1000");
|
||||
Future<String> f = cf.future();
|
||||
Future<Integer> r = f.flatMap(new Mapper<String, Future<Integer>>() {
|
||||
public Future<Integer> checkedApply(String r) throws Throwable {
|
||||
if (false) throw new IOException("Just here to make sure this compiles.");
|
||||
latch.countDown();
|
||||
Promise<Integer> cf = Futures.promise(system.dispatcher());
|
||||
Promise<Integer> cf = Futures.promise();
|
||||
cf.success(Integer.parseInt(r));
|
||||
return cf.future();
|
||||
}
|
||||
|
|
@ -152,7 +152,7 @@ public class JavaFutureTests {
|
|||
@Test
|
||||
public void mustBeAbleToFilterAFuture() throws Throwable {
|
||||
final CountDownLatch latch = new CountDownLatch(1);
|
||||
Promise<String> cf = Futures.promise(system.dispatcher());
|
||||
Promise<String> cf = Futures.promise();
|
||||
Future<String> f = cf.future();
|
||||
Future<String> r = f.filter(Filter.filterOf(new Function<String, Boolean>() {
|
||||
public Boolean apply(String r) {
|
||||
|
|
@ -280,7 +280,7 @@ public class JavaFutureTests {
|
|||
|
||||
@Test
|
||||
public void blockMustBeCallable() throws Exception {
|
||||
Promise<String> p = Futures.promise(system.dispatcher());
|
||||
Promise<String> p = Futures.promise();
|
||||
Duration d = Duration.create(1, TimeUnit.SECONDS);
|
||||
p.success("foo");
|
||||
Await.ready(p.future(), d);
|
||||
|
|
@ -289,7 +289,7 @@ public class JavaFutureTests {
|
|||
|
||||
@Test
|
||||
public void mapToMustBeCallable() throws Exception {
|
||||
Promise<Object> p = Futures.promise(system.dispatcher());
|
||||
Promise<Object> p = Futures.promise();
|
||||
Future<String> f = p.future().mapTo(classTag(String.class));
|
||||
Duration d = Duration.create(1, TimeUnit.SECONDS);
|
||||
p.success("foo");
|
||||
|
|
@ -300,7 +300,7 @@ public class JavaFutureTests {
|
|||
@Test
|
||||
public void recoverToMustBeCallable() throws Exception {
|
||||
final IllegalStateException fail = new IllegalStateException("OHNOES");
|
||||
Promise<Object> p = Futures.promise(system.dispatcher());
|
||||
Promise<Object> p = Futures.promise();
|
||||
Future<Object> f = p.future().recover(new Recover<Object>() {
|
||||
public Object recover(Throwable t) throws Throwable {
|
||||
if (t == fail)
|
||||
|
|
@ -317,11 +317,11 @@ public class JavaFutureTests {
|
|||
@Test
|
||||
public void recoverWithToMustBeCallable() throws Exception{
|
||||
final IllegalStateException fail = new IllegalStateException("OHNOES");
|
||||
Promise<Object> p = Futures.promise(system.dispatcher());
|
||||
Promise<Object> p = Futures.promise();
|
||||
Future<Object> f = p.future().recoverWith(new Recover<Future<Object>>() {
|
||||
public Future<Object> recover(Throwable t) throws Throwable {
|
||||
if (t == fail)
|
||||
return Futures.<Object> successful("foo", system.dispatcher());
|
||||
return Futures.<Object>successful("foo");
|
||||
else
|
||||
throw t;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue