Package akka.dispatch

Examples of akka.dispatch.Future.result()


    public void onReceive(Object message) throws Exception {
      if (message instanceof ActorRef) {
        Future future = ((ActorRef) message).sendRequestReplyFuture("Hello from AsyncFutureActor!", 1000, getContext());
        future.onComplete(new Procedure<Future>() {
          public void apply(Future future) {
            log().logger().info("Result was " + future.result().get());
          }
        });
      }
    }
  }
View Full Code Here


            }
        }

        future2.await();
        if (future2.isCompleted()) {
            if (future2.result().isDefined()) {
                int result = (Integer) future2.result().get();
                System.out.println("counter 2: " + result);
            }
        }
View Full Code Here

        }

        future2.await();
        if (future2.isCompleted()) {
            if (future2.result().isDefined()) {
                int result = (Integer) future2.result().get();
                System.out.println("counter 2: " + result);
            }
        }

        counter1.stop();
View Full Code Here

        } catch (InterruptedException exception) {}
        for (ActorRef counter : counters) {
            Future future = counter.sendRequestReplyFuture("GetCount");
            future.await();
            if (future.isCompleted()) {
                Option resultOption = future.result();
                if (resultOption.isDefined()) {
                    Object result = resultOption.get();
                    int count = (Integer) result;
                    assertEquals(1, count);
                }
View Full Code Here

            }
        }

        future2.await();
        if (future2.isCompleted()) {
            if (future2.result().isDefined()) {
                int result = (Integer) future2.result().get();
                System.out.println("counter 2: " + result);
            }
        }
View Full Code Here

        } catch (InterruptedException exception) {}
        for (ActorRef counter : counters) {
            Future future = counter.sendRequestReplyFuture("GetCount");
            future.await();
            if (future.isCompleted()) {
                Option resultOption = future.result();
                if (resultOption.isDefined()) {
                    Object result = resultOption.get();
                    int count = (Integer) result;
                    assertEquals(0, count);
                }
View Full Code Here

        }

        future2.await();
        if (future2.isCompleted()) {
            if (future2.result().isDefined()) {
                int result = (Integer) future2.result().get();
                System.out.println("counter 2: " + result);
            }
        }

        counter1.stop();
View Full Code Here

        } catch (InterruptedException exception) {}
        for (ActorRef counter : counters) {
            Future future = counter.sendRequestReplyFuture("GetCount");
            future.await();
            if (future.isCompleted()) {
                Option resultOption = future.result();
                if (resultOption.isDefined()) {
                    Object result = resultOption.get();
                    int count = (Integer) result;
                    assertEquals(1, count);
                }
View Full Code Here

        } catch (InterruptedException exception) {}
        for (ActorRef counter : counters) {
            Future future = counter.sendRequestReplyFuture("GetCount");
            future.await();
            if (future.isCompleted()) {
                Option resultOption = future.result();
                if (resultOption.isDefined()) {
                    Object result = resultOption.get();
                    int count = (Integer) result;
                    assertEquals(0, count);
                }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.