Guest User

Untitled

a guest
Feb 24th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. public class MainMaster extends AbstractActor{
  2. private long startTime = System.currentTimeMillis();
  3. private int fileCount = 0;
  4. private int localCount = 0;
  5.  
  6. @Override
  7. public Receive createReceive() {
  8. return receiveBuilder()
  9. .match(FileHashMap.class, f -> {
  10. System.out.println("tCount t||tWords");
  11. System.out.println("-------------------------");
  12. fileCount = f.getFileHash().size()
  13. ActorRef master = this.getContext().actorOf(Props.create(Master.class, 10)
  14. .withRouter(new BalancingPool(fileCount);
  15. for(String file : f.getFileHash())
  16. master.tell(new FileManager(file), getSelf());
  17.  
  18.  
  19. })
  20. .match(String.class, s -> {
  21. localCount++;
  22. if(localCount >= fileCount) {
  23. System.out.println(fileCount);
  24. System.out.println("nn*******Time taken => "+(System.currentTimeMillis() - startTime)+"nn");
  25.  
  26. }
  27. })
  28. .build();
  29. }
  30. }
Add Comment
Please, Sign In to add comment