Package com.dianping.cat.home.router.entity

Examples of com.dianping.cat.home.router.entity.Domain


    Date end = new Date(start.getTime() + TimeHelper.ONE_DAY);
    RouterConfig report = m_reportService.queryRouterConfigReport(Constants.CAT, start, end);

    switch (action) {
    case API:
      Domain domainConfig = m_configManager.getRouterConfig().findDomain(payload.getDomain());

      if (domainConfig == null) {
        if (report != null) {
          Domain domain = report.findDomain(payload.getDomain());
          String str = null;

          if (domain == null) {
            m_configManager.getRouterConfig().getDefaultServers();

            List<Server> servers = m_configManager.queryServersByDomain(payload.getDomain());

            str = buildServerStr(servers);
          } else {
            List<Server> servers = domain.getServers();

            str = buildServerStr(servers);
          }
          model.setContent(str);
        } else {
View Full Code Here


    Collection<Domain> values = routerConfig.getDomains().values();

    for (Domain domain : values) {
      List<Server> domainServers = domain.getServers();
      String domainName = domain.getId();
      Domain defaultDomainConfig = m_configManager.getRouterConfig().getDomains().get(domainName);

      if (defaultDomainConfig == null) {
        Server server = domain.getServers().get(0);
        Map<Server, Long> serverProcess = backServers.get(server);
View Full Code Here

  }

  private void processMainServer(Map<Server, Long> servers, RouterConfig routerConfig, Map<String, Long> numbers) {
    for (Entry<String, Long> entry : numbers.entrySet()) {
      String domainName = entry.getKey();
      Domain defaultDomainConfig = m_configManager.getRouterConfig().getDomains().get(domainName);
      Long value = entry.getValue();

      if (defaultDomainConfig == null) {
        Server server = findMinProcessServer(servers);
        Long oldValue = servers.get(server);
        Domain domainConfig = new Domain(domainName);

        servers.put(server, oldValue + value);
        domainConfig.addServer(server);
        routerConfig.addDomain(domainConfig);
      } else {
        routerConfig.addDomain(defaultDomainConfig);

        Server server = defaultDomainConfig.getServers().get(0);
View Full Code Here

    }
    return result;
  }

  public List<Server> queryServersByDomain(String domain) {
    Domain domainConfig = m_routerConfig.findDomain(domain);
    List<Server> result = new ArrayList<Server>();

    if (domainConfig == null) {
      List<Server> servers = queryEnableServers();
      int length = servers.size();
      int hashCode = domain.hashCode();

      for (int i = 0; i < 2; i++) {
        int index = Math.abs((hashCode + i)) % length;

        addServerList(result, servers.get(index));
      }
      addServerList(result, queryBackUpServer());
    } else {
      for (Server server : domainConfig.getServers()) {
        result.add(server);
      }
    }
    return result;
  }
View Full Code Here

TOP

Related Classes of com.dianping.cat.home.router.entity.Domain

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.