Package akka.actor

Examples of akka.actor.ActorRef


    final JobInfo jobInfo = jobStatus.getJobInfo(directorJobId);
    final AtomicBoolean incomplete = new AtomicBoolean(false);
    ArrayList<Thread> queryList = new ArrayList<Thread>();

    for (final Future<Object> progress : progressList) {
      final ActorRef m = askMap.get(progress);
      Runnable temp = new Runnable() {
        @Override
        public void run() {
          try {
            slaveProgressMessage progressMessage = (slaveProgressMessage) Await
                .result(progress, duration);
            m.tell(new notCongestionSignal(), ActorRef.noSender());
            if (progressMessage.completed) {
              if (!collectedManager.containsKey(m)) {
                completedButNotCollectedManager.add(m);
                collectedManager.put(m, true);
              }
            } else {
              incomplete.getAndSet(true);
            }
            eachWorkerResponseCount.get(
                m.path().toString()).getAndAdd(
                progressMessage.responseCount);
            eachWorkerRequestCount.get(
                m.path().toString()).getAndAdd(
                progressMessage.requestCount);
            jobInfo.capacityUsage.put(
                m.path().address().toString(),
                progressMessage.capacityPercent);
          } catch (Exception e) {
            incomplete.getAndSet(true);
            System.out.println("Monitor query timeout.");
          }
View Full Code Here


          continue;
        }

       
        final NodeData nodeData = entry.getValue();
        final ActorRef worker = getContext().system().actorOf(
            Props.create(AggregationWorker.class,
                  new RequestToAggregationWorker(
                      nodeData, agentCommandType,
                      errorMsgPatternStr, patternStr),
                  fqdn
                ));

        workers.add(worker);

        worker.tell(AggregationWorker.MessageType.PROCESS_REQUEST,
            getSelf());

      }// end for loop
     
      //TODO
View Full Code Here

   * @return
   */
  public void sendAggregationCommandToManager(String patternStr,
      AggregateData aggregateData) {

    ActorRef aggregationManager = null;
    try {
      // Start new job
      String directorJobUuid = UUID.randomUUID().toString();

      models.utils.LogUtils.printLogNormal("!!STARTED sendAggregationCommandToManager : "
View Full Code Here

  private long pauseIntervalWorkerMillis;
  private int sentRequestCounter = 0;
 
  private ActorRef createWorker(String target_node, NodeData nodeData, boolean localmode) {
   
      ActorRef worker = null;
      try {
 
        if (!nodeData.getDataMap().containsKey(
            agentCommandMetadata.getAgentCommandType())) {
View Full Code Here

  public void sendMessageUntilStopCount(int stopCount) {

    // always send with valid data.
    for (int i = processedWorkerCount; i < jobIdQ.size(); ++i) {
      sentRequestCounter ++;
      ActorRef worker =  createWorker(jobIdQ.get(i), nodeDataQ.get(i), localMode);
      try {

        /**
         * !!! This is a must; without this sleep; stuck occured at 5K.
         * AKKA seems cannot handle too much too fast message send out.
         */
        Thread.sleep(1L);

      } catch (InterruptedException e) {
        e.printStackTrace();
      }
     
      // origin manager
      worker.tell(
          OperationWorker.MessageType.PROCESS_REQUEST,
          originalManager);

      processedWorkerCount++;
      trueProcessedWorkerCount++;
View Full Code Here

    }

    @Override
    public ActorRef createAndWatch(Props props)
    {
        final ActorRef actorRef = create(props);
        getContext().watch(actorRef);
        return actorRef;
    }
View Full Code Here

    }

    @Override
    public ActorRef createAndWatch(Props props, String uniqueName)
    {
        final ActorRef actorRef = create(props, uniqueName);
        getContext().watch(actorRef);
        return actorRef;
    }
View Full Code Here

    // create the address object that points to the remote server
    Address addr = new Address("akka", "ServerSys", "127.0.0.1", 2552);

    // creating the ServerActor on the specified remote server
    final ActorRef serverActor = system.actorOf(new Props(ServerActor.class)
        .withDeploy(new Deploy(new RemoteScope(addr))));

    // create a local actor and pass the reference of the remote actor
    actor = system.actorOf(new Props(new UntypedActorFactory() {
      public UntypedActor create() {
View Full Code Here

    // server
    Address addr = AddressFromURIString
        .parse("akka://ServerSys@127.0.0.1:2552");

    // creating the ServerActor on the specified remote server
    final ActorRef serverActor = system.actorOf(new Props(ServerActor.class)
        .withDeploy(new Deploy(new RemoteScope(addr))));

    // create a local actor and pass the reference of the remote actor
    actor = system.actorOf(new Props(new UntypedActorFactory() {
      public UntypedActor create() {
View Full Code Here

  @SuppressWarnings("serial")
  public void remoteActorCreationDemo3() {
    log.info("Creating a actor with remote deployment");

    // creating the ServerActor on the specified remote server
    final ActorRef serverActor = system.actorOf(new Props(ServerActor.class),"remoteServerActor");

    // create a local actor and pass the reference of the remote actor
    actor = system.actorOf(new Props(new UntypedActorFactory() {
      public UntypedActor create() {
        return new ClientActor(serverActor);
View Full Code Here

TOP

Related Classes of akka.actor.ActorRef

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.