Package org.nasutekds.server.replication.protocol

Examples of org.nasutekds.server.replication.protocol.MonitorMsg


        // and send back a MonitorMsg with the full list of all the servers
        // in the topology.
        if (senderHandler.isDataServer())
        {
          // Monitoring information requested by a DS
          MonitorMsg monitorMsg =
            createGlobalTopologyMonitorMsg(
                msg.getDestination(), msg.getSenderID(), false);

           if (monitorMsg != null)
          {
            try
            {
              senderHandler.send(monitorMsg);
            } catch (IOException e)
            {
              // the connection was closed.
            }
          }
          return;
        } else
        {
          // Monitoring information requested by a RS
          MonitorMsg monitorMsg =
            createLocalTopologyMonitorMsg(msg.getDestination(),
            msg.getSenderID());

          if (monitorMsg != null)
          {
            try
            {
              senderHandler.send(monitorMsg);
            } catch (Exception e)
            {
              // We log the error. The requestor will detect a timeout or
              // any other failure on the connection.
              logError(ERR_CHANGELOG_ERROR_SENDING_MSG.get(
                  Integer.toString((msg.getDestination()))));
            }
          }
        }
      } else if (msg instanceof MonitorMsg)
      {
        MonitorMsg monitorMsg =
          (MonitorMsg) msg;

        GlobalServerId globalServerId =
          new GlobalServerId(baseDn, senderHandler.getServerId());
        receivesMonitorDataResponse(monitorMsg, globalServerId);
View Full Code Here


   * during message creation.
   */
  public MonitorMsg createGlobalTopologyMonitorMsg(
      int sender, int destination, boolean updateMonitorData)
  {
    MonitorMsg returnMsg =
      new MonitorMsg(sender, destination);

    try
    {
      returnMsg.setReplServerDbState(getDbServerState());
      // Update the information we have about all servers
      // in the topology.
      MonitorData md = computeMonitorData(updateMonitorData);

      // Add the informations about the Replicas currently in
      // the topology.
      Iterator<Integer> it = md.ldapIterator();
      while (it.hasNext())
      {
        int replicaId = it.next();
        returnMsg.setServerState(
            replicaId, md.getLDAPServerState(replicaId),
            md.getApproxFirstMissingDate(replicaId), true);
      }

      // Add the informations about the Replication Servers
      // currently in the topology.
      it = md.rsIterator();
      while (it.hasNext())
      {
        int replicaId = it.next();
        returnMsg.setServerState(
            replicaId, md.getRSStates(replicaId),
            md.getRSApproxFirstMissingDate(replicaId), false);
      }
    }
    catch (DirectoryException e)
View Full Code Here

   * @return The newly created and filled MonitorMsg. Null if a problem occurred
   * during message creation.
   */
  public MonitorMsg createLocalTopologyMonitorMsg(int sender, int destination)
  {
    MonitorMsg monitorMsg = null;

    try {

      // Lock domain as we need to go through connected servers list
      lock();

      monitorMsg = new MonitorMsg(sender, destination);


      // Populate for each connected LDAP Server
      // from the states stored in the serverHandler.
      // - the server state
      // - the older missing change
      for (DataServerHandler lsh : this.directoryServers.values())
      {
        monitorMsg.setServerState(
          lsh.getServerId(),
          lsh.getServerState(),
          lsh.getApproxFirstMissingDate(),
          true);
      }

      // Same for the connected RS
      for (ReplicationServerHandler rsh : this.replicationServers.values())
      {
        monitorMsg.setServerState(
          rsh.getServerId(),
          rsh.getServerState(),
          rsh.getApproxFirstMissingDate(),
          false);
      }

      // Populate the RS state in the msg from the DbState
      monitorMsg.setReplServerDbState(this.getDbServerState());
    } catch(InterruptedException e)
    {
      // At lock, too bad...
    } finally
    {
View Full Code Here

              replicationServerDomain.getReplicationServer().getServerId() +
              " has been interrupted while sleeping.");
        }

        // Send global topology information to peer DSs
        MonitorMsg monitorMsg =
          replicationServerDomain.createGlobalTopologyMonitorMsg(0, 0, true);
        int localServerId =
            replicationServerDomain.getReplicationServer().getServerId();
        if (monitorMsg != null)
        {
          for (ServerHandler serverHandler :
            replicationServerDomain.getConnectedDSs().values())
          {
            // Set the right sender and destination ids
            monitorMsg.setSenderID(localServerId);
            monitorMsg.setDestination(serverHandler.getServerId());
            try
            {
              serverHandler.send(monitorMsg);
            } catch (IOException e)
            {
View Full Code Here

          // This is the response to a MonitorRequest that was sent earlier or
          // the regular message of the monitoring publisher of the RS.

          // Extract and store replicas ServerStates
          replicaStates = new HashMap<Integer, ServerState>();
          MonitorMsg monitorMsg = (MonitorMsg) msg;
          Iterator<Integer> it = monitorMsg.ldapIterator();
          while (it.hasNext())
          {
            int srvId = it.next();
            replicaStates.put(srvId, monitorMsg.getLDAPServerState(srvId));
          }

          // Notify the sender that the response was received.
          synchronized (monitorResponse)
          {
            monitorResponse.set(true);
            monitorResponse.notify();
          }

          // Update the replication servers ServerStates with new received info
          it = monitorMsg.rsIterator();
          while (it.hasNext())
          {
            int srvId = it.next();
            ReplicationServerInfo rsInfo = replicationServerInfos.get(srvId);
            if (rsInfo != null)
            {
              rsInfo.update(monitorMsg.getRSServerState(srvId));
            }
          }

          // Now if it is allowed, compute the best replication server to see if
          // it is still the one we are currently connected to. If not,
View Full Code Here

TOP

Related Classes of org.nasutekds.server.replication.protocol.MonitorMsg

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.