Examples of AgentId


Examples of fr.dyade.aaa.agent.AgentId

  /**
   * Reaction to the request of adding a new cluster element.
   */
  private void clusterAdd(FwdAdminRequestNot req, String joiningTopic) {
    AgentId newFriendId = AgentId.fromString(joiningTopic);

    // Adds the given topic to the cluster containing the current one.
    if (friends == null) {
      friends = new HashSet();
      friends.add(getId());
View Full Code Here

Examples of fr.dyade.aaa.agent.AgentId

    if (friends == null || friends.size() < 2)
      return;

    for (Iterator e = friends.iterator(); e.hasNext();) {
      AgentId id = (AgentId) e.next();
      if (!id.equals(getId()))
        forward(id, not);
    }
  }
View Full Code Here

Examples of fr.dyade.aaa.agent.AgentId

   * @return the list of unique identifiers of all subscribers.
   */
  public final String[] getSubscriberIds() {
    String[] res = new String[subscribers.size()];
    for (int i = 0; i < res.length; i++) {
      AgentId aid = (AgentId) subscribers.get(i);
      res[i] = aid.toString();
    }
    return res;
  }
View Full Code Here

Examples of fr.dyade.aaa.agent.AgentId

   * hierarchy building request, if needed, or removes the subscriptions of
   * the deleted client, if any, or sets the father identifier to null if it
   * comes from a deleted father.
   */
  protected void doUnknownAgent(UnknownAgent uA) {
    AgentId agId = uA.agent;
    Notification not = uA.not;

    if (not instanceof ClusterJoinNot) {
      ClusterJoinNot cT = (ClusterJoinNot) not;
      logger.log(BasicLevel.ERROR, "Cluster join failed: " + uA.agent + " unknown.");
      String info = "Cluster join failed: Unknown destination.";
      replyToTopic(new AdminReply(AdminReply.BAD_CLUSTER_REQUEST, info), cT.getReplyTo(),
          cT.getRequestMsgId(), cT.getReplyMsgId());
    } else if (not instanceof ClusterJoinAck || not instanceof ClusterRemoveNot) {
      logger.log(BasicLevel.ERROR, "Cluster error: " + uA.agent + " unknown. "
          + "The topic has probably been removed in the meantime.");
      clusterRemove(agId);
    } else {
      setSave(); // state change, so save.
      // Removing the deleted client's subscriptions, if any.
      subscribers.remove(agId);
      selectors.remove(agId);

      // Removing the father identifier, if needed.
      if (agId.equals(fatherId))
        fatherId = null;
    }
  }
View Full Code Here

Examples of fr.dyade.aaa.agent.AgentId

   * <p>
   * <code>UnknownAgent</code> notifications are sent to each subscriber and
   * <code>UnclusterNot</code> notifications to the cluster fellows.
   */
  protected void doDeleteNot(DeleteNot not) {
    AgentId clientId;

    // For each subscriber...
    for (int i = 0; i < subscribers.size(); i++) {
      clientId = (AgentId) subscribers.get(i);
      forward(clientId, new UnknownAgent(getId(), null));
View Full Code Here

Examples of fr.dyade.aaa.agent.AgentId

   * valid subscriptions by sending a <code>TopicMsgsReply</code> notification
   * to the valid subscribers.
   */
  protected void processMessages(ClientMessages not) {
    List messages = not.getMessages();
    AgentId subscriber;
    boolean local;
    String selector;
    List deliverables;
    Message message;

    nbMsgsReceiveSinceCreation = nbMsgsReceiveSinceCreation + messages.size();
   
    // interceptors process
    if (interceptorsAvailable()) {
      DMQManager dmqManager = null;
      List newMessages = new ArrayList();
      Iterator it = messages.iterator();
      while (it.hasNext()) {
        Message m = (Message) it.next();
        // set the destination name to the message
        m.setProperty("JoramDestinationName", getName());
        message = processInterceptors(m);
        if (message != null) {
          newMessages.add(message);
        } else {
          //send message to the DMQ
          if (dmqManager == null)
            dmqManager = new DMQManager(dmqId, getId());
          nbMsgsSentToDMQSinceCreation++;
          dmqManager.addDeadMessage(m, MessageErrorConstants.INTERCEPTORS);
        }
      }
     
      if (dmqManager != null)
        dmqManager.sendToDMQ();
     
      if (!newMessages.isEmpty()) {
        messages = newMessages;
      } else {
        return;
      }
    }
   
    setNoSave();
    boolean persistent = false;

    for (Iterator subs = subscribers.iterator(); subs.hasNext();) {
      // Browsing the subscribers.
      subscriber = (AgentId) subs.next();
      local = (subscriber.getTo() == AgentServer.getServerId());
      selector = (String) selectors.get(subscriber);

      if (selector == null || selector.equals("")) {
        // Current subscriber does not filter messages: all messages
        // will be sent.
View Full Code Here

Examples of fr.dyade.aaa.agent.AgentId

  /**
   * Reaction to the request of adding a new cluster element.
   */
  private void clusterAdd(FwdAdminRequestNot req, String joiningQueue) {
    AgentId newFriendId = AgentId.fromString(joiningQueue);

    if (logger.isLoggable(BasicLevel.DEBUG))
      logger.log(BasicLevel.DEBUG, "--- " + this + " ClusterQueue.addQueueCluster: joiningQueue="
          + joiningQueue + ", clusters=" + clusters);

View Full Code Here

Examples of fr.dyade.aaa.agent.AgentId

   * sent by a fellow queue for notifying this queue to join the cluster, doing
   * a transitive closure of clusters, if any.
   */
  private void clusterJoin(ClusterJoinNot not) {
    for (Iterator e = not.getCluster().iterator(); e.hasNext();) {
      AgentId id = (AgentId) e.next();
      if (!clusters.containsKey(id))
        clusters.put(id, new Float(1));
    }

    sendToCluster(new ClusterJoinAck(new HashSet(clusters.keySet())));
View Full Code Here

Examples of fr.dyade.aaa.agent.AgentId

   * doing a transitive closure with the current cluster and the one of the new
   * cluster element.
   */
  private void clusterJoinAck(ClusterJoinAck not) {
    for (Iterator e = not.getCluster().iterator(); e.hasNext();) {
      AgentId id = (AgentId) e.next();
      if (!clusters.containsKey(id)) {
        clusters.put(id, new Float(1));
      }
    }

View Full Code Here

Examples of fr.dyade.aaa.agent.AgentId

    for (int i = 0; i < toGive.size(); i++) {
      String msgId = (String) toGive.get(i);
      List visit = (List) visitTable.get(msgId);
      boolean transmitted = false;
      for (Iterator e = clusters.keySet().iterator(); e.hasNext();) {
        AgentId id = (AgentId) e.next();
        if (! visit.contains(id)) {
          Message message = getQueueMessage(msgId, true);
          if (message != null) {
            LBCycleLife cycle = (LBCycleLife) table.get(id);
            if (cycle == null) {
              cycle = new LBCycleLife(loadingFactor.getRateOfFlow());
              cycle.setClientMessages(new ClientMessages());
            }
            ClientMessages cm = cycle.getClientMessages();
            cm.addMessage(message.getFullMessage());
            cycle.putInVisitTable(msgId,visit);
            table.put(id,cycle);
            transmitted = true;
            break;
          }
        }
      }
      if (!transmitted) {
        if (logger.isLoggable(BasicLevel.DEBUG))
          logger.log(BasicLevel.DEBUG, " All queues already visited. Re-initialize visitTable.");
        ((List) visitTable.get(msgId)).clear();
      }
    }

    for (Iterator e = table.keySet().iterator(); e.hasNext();) {
      AgentId id = (AgentId) e.next();
      forward(id,(LBCycleLife) table.get(id));
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.