Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class MachineInfo {
- private String hostname;
- // getters and setters here
- }
- public static String pickRandomMachine(List<MachineInfo> machines) {
- String hostname = null;
- Collections.shuffle(machines, new Random(System.nanoTime()));
- for (MachineInfo info : machines) {
- if (!checkHostUptime(info.getHostName())) {
- continue;
- }
- hostname = info.getHostName();
- break;
- }
- return hostname;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement