Package RemoteCluster.CommunicationMessages

Examples of RemoteCluster.CommunicationMessages.collecterCheckResponse


      }
      getContext().system().scheduler().scheduleOnce(Duration.create(1, TimeUnit.SECONDS),
          new Runnable() {
              @Override
              public void run() {
                getSelf().tell(new collecterCheckResponse(), ActorRef.noSender());
           }
      }, getContext().system().dispatcher());
     
    } else if (message instanceof collecterCheckResponse){
      FiniteDuration duration = Duration.create(
          10, TimeUnit.SECONDS);
      Future<Object> futureList = Patterns.ask(monitor, new queryMonitorForResponse(), new Timeout(duration));
      try {
        List<ActorRef> collectList = (List<ActorRef>) Await.result(futureList, duration);
        if (collectList.size() > 0) {
          for (ActorRef m : collectList) {
            slaveQ.offer(m);
            atomic.incrementAndGet();
          }
          for (ActorRef m : individualCollectors) {
            atomic.incrementAndGet();
            m.tell("start", getSelf());
          }
        }
      } catch (Exception e) {
        System.out.println("Collector ask monitor timeout");
      }
 
      if (atomic.intValue() == 0 && jobInfo.state == State.finishedNotGathered) {
        director.tell(collectedResponse, getSelf());
        for (ActorRef ic : individualCollectors) {
          getContext().stop(ic);
        }
        individualCollectors.clear();
      } else {
        getContext().system().scheduler().scheduleOnce(Duration.create(2, TimeUnit.SECONDS),
            new Runnable() {
                @Override
                public void run() {
                  getSelf().tell(new collecterCheckResponse(), ActorRef.noSender());
             }
        }, getContext().system().dispatcher());
      }
    } else if (message instanceof BatchResponseFromManager) {
      BatchResponseFromManager res = (BatchResponseFromManager) message;
View Full Code Here

TOP

Related Classes of RemoteCluster.CommunicationMessages.collecterCheckResponse

Copyright © 2018 www.massapicom. 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.