Examples of duration()


Examples of akka.util.Timeout.duration()

    calculator.incrementCount();

    // Invoke the method and wait for result
    Future<Integer> future = calculator.add(Integer.valueOf(14),
        Integer.valueOf(6));
    Integer result = Await.result(future, timeout.duration());

    System.out.println("Result is " + result);

    Option<Integer> counterResult = calculator.incrementAndReturn();
    System.out.println("Result is " + counterResult.get());
View Full Code Here

Examples of akka.util.Timeout.duration()

    calculator.incrementCount();

    // Invoke the method and wait for result
    Future<Integer> future = calculator.add(Integer.valueOf(14),
        Integer.valueOf(6));
    Integer result = Await.result(future, timeout.duration());

    System.out.println("Result is " + result);

    Option<Integer> counterResult = calculator.incrementAndReturn();
    System.out.println("Result is " + counterResult.get());
View Full Code Here

Examples of akka.util.Timeout.duration()

        "myScatterGatherFirstCompletedRouterActor");

    Timeout timeout = new Timeout(Duration.create(10, "seconds"));
    Future<Object> futureResult = akka.pattern.Patterns.ask(
        scatterGatherFirstCompletedRouter, "message", timeout);
    String result = (String) Await.result(futureResult, timeout.duration());
    System.out.println(result);

    _system.shutdown();

  }
View Full Code Here

Examples of akka.util.Timeout.duration()

    Thread.sleep(500);
   
    // Invoke the method and wait for result
    Timeout timeout = new Timeout(Duration.parse("5 seconds"));
      Future<Object> future = Patterns.ask(calActor, Integer.valueOf(10), timeout);
      Integer result = (Integer) Await.result(future, timeout.duration());
   
    System.out.println("Result from child actor->" + result);

    //wait before shutting down the system
    Thread.sleep(500);
View Full Code Here

Examples of akka.util.Timeout.duration()

    private void retrieveMessages(ActorSystem system) throws Exception {
        ActorRef service = getService(system);
        Timeout timeout = new Timeout(Duration.create(2, TimeUnit.SECONDS));
        Future<Object> fBets = Patterns.ask(service, new RetrieveBets(), timeout);
        List<Bet> bets = (List<Bet>) Await.result(fBets, timeout.duration());
        assert bets.size() == 200;
        System.out.println("*** TESTING OK");
    }

    private ActorRef getService(ActorSystem system) {
View Full Code Here

Examples of akka.util.Timeout.duration()

    // create an akka future which holds the commit message (if any) of the eventDefinitionActor
    Future<Object> future = Patterns.ask(eventDefinitionActor, message, eventDefinitionTimeout);

    try {
      // make a synchronous ('Await.result') request ('Patterns.ask') to the event definition actor
      Await.result(future, eventDefinitionTimeout.duration());
    } catch (java.util.concurrent.TimeoutException timeout) {
      LOG.error(String.format("Unhandled timeout while processing %s at EventDefintition:%s. Timeout was set to %s",
          message.getClass().getSimpleName(), eventDefinitionActor, eventDefinitionTimeout.duration()));
    } catch (Exception e) {
      e.printStackTrace();
View Full Code Here

Examples of akka.util.Timeout.duration()

    try {
      // make a synchronous ('Await.result') request ('Patterns.ask') to the event definition actor
      Await.result(future, eventDefinitionTimeout.duration());
    } catch (java.util.concurrent.TimeoutException timeout) {
      LOG.error(String.format("Unhandled timeout while processing %s at EventDefintition:%s. Timeout was set to %s",
          message.getClass().getSimpleName(), eventDefinitionActor, eventDefinitionTimeout.duration()));
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
 
View Full Code Here

Examples of akka.util.Timeout.duration()

   
    Timeout timeout = new Timeout(Duration.create(numberOfSecondsTimeout, "seconds"));
    Future<Object> future = Patterns.ask(actorLevel1, new Message_Runner_to_AL1(parameters, functionToApply), timeout);
    List<Object> results = new ArrayList<Object>();
    try {
      results = (List<Object>) Await.result(future, timeout.duration());
    } catch (Exception e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    return results;
View Full Code Here

Examples of akka.util.Timeout.duration()

    ActorRef actor = system.actorOf(Props.create(MyActor.class));
    String msg = "hello";
    //#ask-blocking
    Timeout timeout = new Timeout(Duration.create(5, "seconds"));
    Future<Object> future = Patterns.ask(actor, msg, timeout);
    String result = (String) Await.result(future, timeout.duration());
    //#ask-blocking
    //#pipe-to
    akka.pattern.Patterns.pipe(future, system.dispatcher()).to(actor);
    //#pipe-to
    assertEquals("HELLO", result);
View Full Code Here

Examples of akka.util.Timeout.duration()

   
    Timeout timeout = new Timeout(Duration.create(numberOfSecondsTimeout, "seconds"));
    Future<Object> future = Patterns.ask(actorLevel1, new Message_Runner_to_AL1(parameters, functionToApply), timeout);
    List<Object> results = new ArrayList<Object>();
    try {
      results = (List<Object>) Await.result(future, timeout.duration());
    } catch (Exception e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    return results;
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.