public FacilityManagerMasterImpl(Config config) throws IOException, AlreadyBoundException, InterruptedException { super(config); currentNode = 0; String[] participants = config.getParticipantIps(); int expectedNumParticipants = participants.length; managers = new FacilityManager[expectedNumParticipants]; managers[getNodeId()] = this; clusterName = config.getClusterName(); rmiPort = config.getRmiPort(); /* FILESYSTEM INIT */ fsTable = Collections.synchronizedMap(new HashMap<String, Map<Integer, Set<Integer>>>()); Registry r = LocateRegistry.createRegistry(rmiPort); r.bind(clusterName + REGISTRY_MASTER_KEY, UnicastRemoteObject.exportObject(this, 0)); connectParticipants(); System.out.println("Waiting for slaves to connect..."); while (managers.length != expectedNumParticipants) { Thread.sleep(1000); } healthChecker = new HealthChecker(this, expectedNumParticipants); scheduler = new JobScheduler(this, config); dispatcher = new JobDispatcher(this, config); dispatcher.setScheduler(scheduler); scheduler.setDispatcher(dispatcher); scheduler.setHealthChecker(healthChecker); healthChecker.start(); dispatcher.start(); System.out.println("All slaves connected."); }