Examples of CountingMap


Examples of io.fabric8.utils.CountingMap

        }
    }

    public static void dumpHostProfiles(HostProfileCounter hostProfileCounter) {
        for (Map.Entry<String, CountingMap> entry : hostProfileCounter.getHostToProfileCounts().entrySet()) {
            CountingMap countingMap = entry.getValue();
            String host = entry.getKey();
            LOG.info("Host " + host + " has " + countingMap);
        }
    }
View Full Code Here

Examples of io.fabric8.utils.CountingMap

     * lets assert that no host has more than its maximum number of containers
     */
    public static void assertMaximumContainerCountNotExceeded(FabricRequirements requirements, Map<String, CountingMap> hostToProfileCounts) {
        for (Map.Entry<String, CountingMap> entry : hostToProfileCounts.entrySet()) {
            String hostName = entry.getKey();
            CountingMap counts = entry.getValue();
            int total = counts.total();
            SshConfiguration sshConfiguration = requirements.getSshConfiguration();
            assertNotNull("Should have a sshConfiguration!", sshConfiguration);
            SshHostConfiguration hostConfiguration = sshConfiguration.getHost(hostName);
            assertNotNull("Should have a hosts configuration for host " + hostName, hostConfiguration);
            Integer maximumContainerCount = hostConfiguration.getMaximumContainerCount();
View Full Code Here

Examples of io.fabric8.utils.CountingMap

     * lets assert that no host has more than its maximum number of containers
     */
    public static void assertProfilesUseSeparateHost(FabricRequirements requirements, Map<String, CountingMap> hostToProfileCounts) {
        for (Map.Entry<String, CountingMap> entry : hostToProfileCounts.entrySet()) {
            String hostName = entry.getKey();
            CountingMap counts = entry.getValue();
            Set<String> keys = counts.keySet();
            for (String profileId : keys) {
                int count = counts.count(profileId);
                // lets see if we have a maximum number of profile count
                ProfileRequirements profileRequirement = requirements.getOrCreateProfileRequirement(profileId);
                Integer maximum = profileRequirement.getMaximumInstancesPerHost();
                if (maximum != null) {
                    assertTrue("Host " + hostName + " has " + count + " instances of " + profileId
View Full Code Here

Examples of io.fabric8.utils.CountingMap

    public void setContainerCount(String host, int count) {
        hostContainerCounts.setCount(host, count);
    }

    public int incrementProfileCount(String host, String profileId) {
        CountingMap countingMap = profileCounts(host);
        return countingMap.increment(profileId);
    }
View Full Code Here

Examples of io.fabric8.utils.CountingMap

        CountingMap countingMap = profileCounts(host);
        return countingMap.increment(profileId);
    }

    public CountingMap profileCounts(String host) {
        CountingMap countingMap = hostToProfileCounts.get(host);
        if (countingMap == null) {
            countingMap = new CountingMap();
            hostToProfileCounts.put(host, countingMap);
        }
        return countingMap;
    }
View Full Code Here

Examples of io.fabric8.utils.CountingMap

        }
        return countingMap;
    }

    public void incrementProfilesCount(String hostAlias, List<String> profileIds) {
        CountingMap counts = profileCounts(hostAlias);
        counts.incrementAll(profileIds);
    }
View Full Code Here

Examples of io.fabric8.utils.CountingMap

        CountingMap counts = profileCounts(hostAlias);
        counts.incrementAll(profileIds);
    }

    public void decrementProfilesCount(String hostAlias, List<String> profileIds) {
        CountingMap counts = profileCounts(hostAlias);
        counts.decrementAll(profileIds);
    }
View Full Code Here

Examples of io.fabric8.utils.CountingMap

        CountingMap counts = profileCounts(hostAlias);
        counts.decrementAll(profileIds);
    }

    public int profileCount(String hostAlias, String profileId) {
        CountingMap counts = profileCounts(hostAlias);
        return counts.count(profileId);
    }
View Full Code Here

Examples of org.groovymud.utils.CountingMap

      }
    }
  }

  protected void checkPlayerHandles() {
    CountingMap netDead = getNetDeadPlayers();
    Set<Player> totallyDead = netDead.getKeysAbove(30);

    for (Player p : totallyDead) {
      p.removeStatus(NET_DEAD_STATUS);
      p.dest(false);
      getNetDeadPlayers().remove(p);
View Full Code Here

Examples of org.groovymud.utils.CountingMap

  }

  protected void handleTheNetDead() {

    Iterator<LoginShell> x = new HashSet<LoginShell>(getObjectRegistry().getActivePlayerHandles()).iterator();
    CountingMap netDead = getNetDeadPlayers();
    while (x.hasNext()) {
      LoginShell shell = x.next();
      if (!shell.getConnection().isActive()) {
        Player p = getObjectRegistry().getPlayerByHandle(shell);
        if (!netDead.containsKey(p)) {
          // not a good way to do it.. but how.. ?
          logger.info(p.getName() + " is net dead..");
          p.addStatus(NET_DEAD_STATUS);
        }
        netDead.increment(p);
      }
    }
  }
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.