Package akka.actor

Examples of akka.actor.ActorSystem.shutdown()


    for (int i = 1; i <= 10; i++) {
      // sends randomly to actors
      randomRouter.tell(i);
    }
    _system.shutdown();
  }

}
View Full Code Here


    ActorRef router = _system.actorOf(new Props()
        .withRouter(BroadcastRouter.create(routees)));

    router.tell("Hello there");

    _system.shutdown();

  }

}
View Full Code Here

    for (int i = 1; i <= 13; i++) {
      //sends series of messages in a round robin way to all the actors
      burstyMessageRouter.tell(i);
    }
    _system.shutdown();

  }

}
View Full Code Here

    for (int i = 1; i <= 10; i++) {
      //works like roundrobin but tries to rebalance the load based on
      //size of actor's mailbox
      smallestMailBoxRouter.tell(i);
    }
    _system.shutdown();

  }

}
View Full Code Here

    actor.tell("Hello");

    Thread.sleep(500);

    system.shutdown();

  }

  @Override
  public void onReceive(Object message) throws Exception {
View Full Code Here

    for (int i = 1; i <= 2; i++) {
      //same message goes to all the actors
      broadcastRouter.tell(i);
    }
    _system.shutdown();

  }

}
View Full Code Here

    for (int i = 1; i <= 10; i++) {
      //sends randomly to actors
      randomRouter.tell(i);
    }
    _system.shutdown();
  }

}
View Full Code Here

    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

      if (i == 5) {
        TimeUnit.MILLISECONDS.sleep(100);
        System.out.println("\n");
      }
    }
    _system.shutdown();
  }

}
View Full Code Here

    for (int i = 0; i < 5; i++)
      updateThreads[i].start();

    Thread.sleep(3000);
    _system.shutdown();

  }
}
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.