public void receiveJobRequest(JobMetadata jobMetadata) { Common.Logger().LogInfo("Job Request received", string.Empty, string.Empty); //now he is a Job Tracker. Implement all job tracker functions upon this //Start channel with other workers as Job tracker JOBTRACKER_URL = serviceUrl;//I set my own as job tracker url isJobTracker = true; CLIENT_URL = jobMetadata.ClientUrl; Console.WriteLine("Job request received for " + JOBTRACKER_URL, string.Empty, string.Empty); //start jobtracker threads //TrackerDetails trackerDetails = new TrackerDetails(CLIENT_URL, existingWorkerMap); trackerTask = new TrackerTask(CLIENT_URL, existingWorkerMap, workerId); client = (IClient)Activator.GetObject(typeof(IClient), CLIENT_URL); trackerTask.notifyWorkersForJobStart(); if (existingWorkerMap.Count > 1) { trackerTask.startHeartBeat();//should work even with 1 } trackerTask.splitJob(jobMetadata); }
public void unfreezeTracker() { if (trackerTask != null && isJobTracker) { Console.WriteLine("going to unfreeze tracker" + workerId); trackerTask.startHeartBeat();//restart communication, but eventually he will detect that he is no longer the jt and then will giveup trackerTask.IsTrackerFreezed = false; Common.Logger().LogInfo("Going to unfreeze tracker. But current tracker URL is " + Worker.JOBTRACKER_URL, string.Empty, string.Empty); } }