Package fr.dyade.aaa.agent

Examples of fr.dyade.aaa.agent.AgentId


   *
   * @param serverId the id of the agent server
   * @return the <code>AgentId</code> of the JndiServer
   */
  public static AgentId getDefault(short serverId) {
    return new AgentId(
      serverId, serverId,
      AgentId.LocalJndiServiceStamp);
  }
View Full Code Here


    impl.destroySubcontext(
      request.getName());
  }

  protected void changeOwner(ChangeOwnerRequest request) throws NamingException {
    AgentId newOwnerId;
    try {
      newOwnerId =
        AgentId.fromString(request.getOwnerId());
    } catch (Exception exc) {
      NamingException ne =
View Full Code Here

    servers = (Vector)AgentServer.getTransaction().load(SERVER_LIST);
    if (servers == null) {
      servers = new Vector();     
      for (int i = 0; i < serverIds.length; i++) {       
        AgentId aid = DistributedJndiServer.getDefault(serverIds[i]);
        servers.addElement(aid);
        sendTo(aid, new InitJndiServerNot(null, null, true));
      }
      saveServers();
    }
View Full Code Here

      servers.copyInto(localJndiServerIds);
      NamingContextInfo[] localContexts =
        getServerImpl().copyNamingContexts(getId());
      int serversInitialLength = servers.size();
      for (int i = 0; i < initServers.size(); i++) {
        AgentId newServerId =
          (AgentId)initServers.elementAt(i);
        /** Modif */
        if (!(rootOwnerId.equals(initServers.elementAt(i))))
          sendTo(newServerId, new InitJndiServerNot(
                                                    localJndiServerIds,
View Full Code Here

    }
  }

  public void onUpdate(UpdateEvent event) {
    for (int i = 0; i < servers.size(); i++) {
      AgentId aid = (AgentId)servers.elementAt(i);
      sendTo(aid, new JndiUpdateNot(event));
    }
  }
View Full Code Here

    setSave();

    //setCtx(cKey);

    // Denying the non acknowledged messages:
    AgentId id;
    boolean prepared = false;
    for (Iterator ids = activeCtx.getDeliveringQueues(); ids.hasNext();) {
      id = (AgentId) ids.next();

      for (Iterator xids = activeCtx.getTxIds(); xids.hasNext();) {
        Xid xid = (Xid) xids.next();
        if (activeCtx.isPrepared(xid)) {
          prepared = true;
          break;
        }
      }
      if (!prepared)
        sendNot(id, new DenyRequest(key));
      prepared = false;
    }

    // Removing or deactivating the subscriptions:
    String subName = null;
    ClientSubscription sub;
    List topics = new Vector();
    for (Iterator subs = activeCtx.getActiveSubs(); subs.hasNext();) {
      subName = (String) subs.next();
      sub = (ClientSubscription) subsTable.get(subName);

      if (logger.isLoggable(BasicLevel.DEBUG))
        logger.log(BasicLevel.DEBUG,
            "Deactivate subscription " + subName + ", topic id = " + sub.getTopicId());

      if (sub.getDurable()) {
        sub.deactivate();

        if (logger.isLoggable(BasicLevel.DEBUG))
          logger.log(BasicLevel.DEBUG, "Durable subscription" + subName + " de-activated.");
      } else {
        if (logger.isLoggable(BasicLevel.DEBUG))
          logger.log(BasicLevel.DEBUG, " -> topicsTable = " + topicsTable);

        sub.delete();
        subsTable.remove(subName);
        try {
          MXWrapper.unregisterMBean(getSubMBeanName(subName));
        } catch (Exception e) {
          if (logger.isLoggable(BasicLevel.WARN))
            logger.log(BasicLevel.WARN, "  - Problem when unregistering ClientSubscriptionMbean", e);
        }
        TopicSubscription tSub = (TopicSubscription) topicsTable.get(sub
            .getTopicId());
        tSub.removeSubscription(subName);

        if (!topics.contains(sub.getTopicId()))
          topics.add(sub.getTopicId());

        if (logger.isLoggable(BasicLevel.DEBUG))
          logger.log(BasicLevel.DEBUG, "Temporary subscription" + subName + " deleted.");
      }
    }
    // Browsing the topics which at least have one subscription removed.
    for (Iterator topicIds = topics.iterator(); topicIds.hasNext();)
      updateSubscriptionToTopic((AgentId) topicIds.next(), -1, -1);

    // Deleting the temporary destinations:
    AgentId destId;
    for (Iterator dests = activeCtx.getTempDestinations(); dests.hasNext();) {
      destId = (AgentId) dests.next();
      activeCtx.removeTemporaryDestination(destId);
      deleteTemporaryDestination(destId);

      if (logger.isLoggable(BasicLevel.DEBUG))
        logger.log(BasicLevel.DEBUG, "Deletes temporary" + " destination " + destId.toString());
    }

    // Saving the prepared transactions.
    Iterator xids = activeCtx.getTxIds();
    Xid xid;
View Full Code Here

   
    Enumeration pms = req.getProducerMessages();
    if (pms != null) {
      while (pms.hasMoreElements()) {
        ProducerMessages pm = (ProducerMessages) pms.nextElement();
        AgentId destId = AgentId.fromString(pm.getTarget());
        ClientMessages not = new ClientMessages(key,
            req.getRequestId(), pm.getMessages());
        setDmq(not);   
        if (destId.getTo() == getId().getTo()) {
          // local sending
          not.setPersistent(false);
          if (req.getAsyncSend()) {
            not.setAsyncSend(true);
          } else {
            asyncReplyCount++;
          }
        }
        sendNot(destId, not);
      }
    }
   
    Enumeration acks = req.getAckRequests();
    if (acks != null) {
      while (acks.hasMoreElements()) {
        SessAckRequest sar = (SessAckRequest) acks.nextElement();
        if (sar.getQueueMode()) {
          AgentId qId = AgentId.fromString(sar.getTarget());
          Vector ids = sar.getIds();
          AcknowledgeRequest not = new AcknowledgeRequest(activeCtxId, req
              .getRequestId(), ids);
          if (qId.getTo() == getId().getTo()) {
            // local sending
            not.setPersistent(false);
            // No reply to wait for
          }
View Full Code Here

   */
  private void doReact(UnknownAgent uA) {
    if (logger.isLoggable(BasicLevel.DEBUG))
      logger.log(BasicLevel.DEBUG, "UserAgent.doReact(" + uA + ')');
    Notification not = uA.not;
    AgentId agId = uA.agent;

    if (logger.isLoggable(BasicLevel.INFO))
      logger.log(BasicLevel.INFO, "--- " + this + " notified of invalid destination: " + agId.toString());

    // The deleted destination is a topic: deleting its subscriptions.
    if (logger.isLoggable(BasicLevel.DEBUG))
      logger.log(BasicLevel.DEBUG, " -> topicsTable.remove(" + agId + ')');
    TopicSubscription tSub = (TopicSubscription) topicsTable.remove(agId);
    if (tSub != null) {
      String name;
      ClientSubscription sub;
      DestinationException exc;
      exc = new DestinationException("Destination " + agId + " does not exist.");
      for (Iterator e = tSub.getNames(); e.hasNext();) {
        name = (String) e.next();
        sub = (ClientSubscription) subsTable.remove(name);
        try {
          MXWrapper.unregisterMBean(getSubMBeanName(name));
        } catch (Exception e1) {
          if (logger.isLoggable(BasicLevel.WARN))
            logger.log(BasicLevel.WARN, "  - Problem when unregistering ClientSubscriptionMbean", e1);
        }
        sub.delete();

        try {
          setCtx(sub.getContextId());
          activeCtx.removeSubName(name);
          doReply(new MomExceptionReply(sub.getSubRequestId(), exc));
        } catch (StateException pExc) {}
      }
      return;
    }

    if (not instanceof AbstractRequestNot) {
      AbstractRequestNot req = (AbstractRequestNot) not;

      // If the wrapped request is messages sending,forwarding them to the DMQ:
      if (req instanceof ClientMessages) {
        // If the queue actually was a dead message queue, updating its
        // identifier:
        if (dmqId != null && agId.equals(dmqId)) {
          // state change, so save.
          setSave();
          dmqId = null;
          for (Iterator subs = subsTable.values().iterator(); subs.hasNext();)
            ((ClientSubscription) subs.next()).setDMQId(null);
        }
        // Sending the messages again if not coming from the default DMQ:
        if (Queue.getDefaultDMQId() != null && !agId.equals(Queue.getDefaultDMQId())) {
          DMQManager dmqManager = new DMQManager(dmqId, null);
          Iterator msgs = ((ClientMessages) req).getMessages().iterator();
          while (msgs.hasNext()) {
            org.objectweb.joram.shared.messages.Message msg = (org.objectweb.joram.shared.messages.Message) msgs.next();
            nbMsgsSentToDMQSinceCreation++;
View Full Code Here

    if (not.getReplyTo() != null) {
      replyToTopic(new AdminReply(true, info), not.getReplyTo(), not.getRequestMsgId(), not.getReplyMsgId());
    }

    // Removing all proxy's subscriptions:
    AgentId destId;
    for (Iterator topics = topicsTable.keySet().iterator(); topics.hasNext();) {
      destId = (AgentId) topics.next();
      if (logger.isLoggable(BasicLevel.DEBUG))
        logger.log(BasicLevel.DEBUG, " -> topicsTable.remove(" + destId + ')');
      topics.remove();
View Full Code Here

      if (logger.isLoggable(BasicLevel.DEBUG))
        logger.log(BasicLevel.DEBUG, " -> subName = " + subName);
     
      ClientSubscription cSub = (ClientSubscription) subEntry.getValue();
      AgentId destId = cSub.getTopicId();
//      if (! topics.contains(destId))
//        topics.add(destId);
      cSub.reinitialize(messagesTable, messages, false);

      if (logger.isLoggable(BasicLevel.DEBUG))
View Full Code Here

TOP

Related Classes of fr.dyade.aaa.agent.AgentId

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.