示例#1
0
 @Test
 public void testTenMillions() throws Exception {
   SimpleLogger.enableTrace(false);
   startedTime = System.currentTimeMillis();
   system = Actors.newContext("LoadGeneratorApp");
   final Actor appManager = system.create(new JobControllerActor(nbrOfWorkers), "jobController");
   router =
       system.create(
           LoadBalancerActor.apply(
               system,
               10L,
               new Function<Unit, WorkerActor>() {
                 @Override
                 public WorkerActor apply(Unit t) {
                   return new WorkerActor(appManager);
                 }
               }),
           "router");
   generateLoad();
   latch.await();
   router.tell(new Broadcast(Poison.PILL));
   router.tell(Poison.PILL);
   appManager.tell(Poison.PILL);
   SimpleLogger.enableTrace(true);
 }
示例#2
0
 private void generateLoad() {
   for (int i = nbrOfWorkers; i >= 0; i--) {
     router.tell("Job Id " + i + "# send");
   }
   System.out.println("All jobs sent successfully");
 }