Java 类akka.actor.LocalActorRef 实例源码

项目:kaa    文件:TenantActor.java   
/**
 * Process termination.
 *
 * @param message the message
 */
private void processTermination(Terminated message) {
  ActorRef terminated = message.actor();
  if (terminated instanceof LocalActorRef) {
    LocalActorRef localActor = (LocalActorRef) terminated;
    String name = localActor.path().name();
    if (applications.remove(name) != null) {
      LOG.debug("[{}] removed application: {}", tenantId, localActor);
    } else if (localUsers.remove(name) != null) {
      LOG.debug("[{}] removed local user: {}", tenantId, localActor);
    } else if (globalUsers.remove(name) != null) {
      LOG.debug("[{}] removed global user: {}", tenantId, localActor);
    }
  } else {
    LOG.warn("remove commands for remote actors are not supported yet!");
  }
}
项目:iotplatform    文件:SessionManagerActor.java   
private void onTermination(Terminated message) {
  ActorRef terminated = message.actor();
  if (terminated instanceof LocalActorRef) {
    log.info("Removed actor: {}.", terminated);
    // TODO: cleanup session actors map
  } else {
    throw new IllegalStateException("Remote actors are not supported!");
  }
}
项目:iotplatform    文件:AppActor.java   
private void processTermination(Terminated message) {
  ActorRef terminated = message.actor();
  if (terminated instanceof LocalActorRef) {
    logger.debug("Removed actor: {}", terminated);
  } else {
    throw new IllegalStateException("Remote actors are not supported!");
  }
}
项目:kaa    文件:TopicActor.java   
/**
 * Process termination.
 *
 * @param message the message
 */
private void processTermination(Terminated message) {
  ActorRef terminated = message.actor();
  if (terminated instanceof LocalActorRef) {
    LocalActorRef localActor = (LocalActorRef) terminated;
    String name = localActor.path().name();
    if (endpointSessions.remove(name) != null) {
      LOG.debug("removed: {}", localActor);
    }
  } else {
    LOG.warn("remove commands for remote actors are not supported yet!");
  }
}
项目:kaa    文件:ApplicationActor.java   
/**
 * Process termination.
 *
 * @param message the message
 */
private void processTermination(Terminated message) {
  ActorRef terminated = message.actor();
  if (terminated instanceof LocalActorRef) {
    LocalActorRef localActor = (LocalActorRef) terminated;
    String name = localActor.path().name();
    EndpointObjectHash endpointHash = endpointActorMap.remove(name);
    if (endpointHash != null) {
      LocalEndpointActorMetaData actorMetaData = localEndpointSessions.get(endpointHash);
      if (actorMetaData != null && actorMetaData.actorRef.equals(localActor)) {
        localEndpointSessions.remove(endpointHash);
        LOG.debug("[{}] removed endpoint: {}", appToken, localActor);
        notifyGlobalEndpointActor(endpointHash,
            actorMetaData.globalActorNodeId, RouteOperation.DELETE);
      }
    } else if (topicSessions.remove(name) != null) {
      LOG.debug("[{}] removed topic: {}", appToken, localActor);
    } else if (logsSessions.remove(name) != null) {
      LOG.debug("[{}] removed log: {}", appToken, localActor);
      applicationLogActor = getOrCreateLogActor(name);
      LOG.debug("[{}] created log: {}", appToken, applicationLogActor);
    } else if (userVerifierSessions.remove(name) != null) {
      LOG.debug("[{}] removed log: {}", appToken, localActor);
      userVerifierActor = getOrCreateUserVerifierActor(name);
      LOG.debug("[{}] created log: {}", appToken, applicationLogActor);
    }
  } else {
    LOG.warn("remove commands for remote actors are not supported yet!");
  }
}
项目:kaa    文件:LocalUserActorMessageProcessor.java   
void processTerminationMessage(ActorContext context, Terminated message) {
  ActorRef terminated = message.actor();
  if (terminated instanceof LocalActorRef) {
    LocalActorRef localActor = (LocalActorRef) terminated;
    String name = getActorPathName(localActor);
    EndpointObjectHash endpoint = endpoints.remove(name);
    if (endpoint != null) {
      boolean stilPresent = false;
      for (EndpointObjectHash existingEndpoint : endpoints.values()) {
        if (existingEndpoint.equals(endpoint)) {
          stilPresent = true;
          break;
        }
      }
      if (stilPresent) {
        LOG.debug("[{}] received termination message for endpoint actor [{}], "
            + "but other actor is still registered for this endpoint.",
            userId, localActor);
      } else {
        removeEndpoint(context, endpoint);
        LOG.debug("[{}] removed endpoint [{}]", userId, localActor);
      }
    }
  } else {
    LOG.warn("remove commands for remote actors are not supported yet!");
  }
}