private String[] getHosts() {
String prefix = "filewatcher.test.host.";
Map hosts = InfoHelper.getPropertiesStartingWith(prefix, this, null);
String[] keys = (String[])hosts.keySet().toArray(new String[hosts.size()]);
TreeMap newHosts = new TreeMap();
// we want them in a random order
Random random = new Random();
for (int i=0; i < keys.length; i++) {
String tmp = (String)hosts.get(keys[i]);
int nmax = Integer.parseInt(tmp);
if (nmax < 1)
nmax = 1;
else if (nmax > 10)
nmax = 10;
for (int j=0; j < nmax; j++) {
Double newKey = new Double(random.nextDouble());
newHosts.put(newKey, keys[i]);
}
}
return (String[])newHosts.values().toArray(new String[newHosts.size()]);
}