Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class MainMaster extends AbstractActor{
- private long startTime = System.currentTimeMillis();
- private int fileCount = 0;
- private int localCount = 0;
- @Override
- public Receive createReceive() {
- return receiveBuilder()
- .match(FileHashMap.class, f -> {
- System.out.println("tCount t||tWords");
- System.out.println("-------------------------");
- fileCount = f.getFileHash().size()
- ActorRef master = this.getContext().actorOf(Props.create(Master.class, 10)
- .withRouter(new BalancingPool(fileCount);
- for(String file : f.getFileHash())
- master.tell(new FileManager(file), getSelf());
- })
- .match(String.class, s -> {
- localCount++;
- if(localCount >= fileCount) {
- System.out.println(fileCount);
- System.out.println("nn*******Time taken => "+(System.currentTimeMillis() - startTime)+"nn");
- }
- })
- .build();
- }
- }
Add Comment
Please, Sign In to add comment