def METHOD_NAME(self, worker, idleTime, heartbeatTimeout):
    """
    Prepares a worker thread before running
    """
    # Work timing
    worker.idleTime = idleTime
    worker.component = self.component
    self.lock.acquire()
    self.slavecounter += 1
    worker.slaveid = "%s-%s" % (self.wtmnumber, self.slavecounter)
    self.lock.release()
    # Thread synchronisation
    worker.notifyTerminate = self.terminateSlaves
    worker.terminateCallback = self.slaveTerminateCallback
    worker.notifyPause = self.pauseSlaves
    worker.notifyResume = self.resumeSlaves
    if hasattr(self.component.config, "Agent"):
        if getattr(self.component.config.Agent, "useHeartbeat", True):
            worker.heartbeatAPI = HeartbeatAPI(self.component.config.Agent.componentName,
                                               idleTime, heartbeatTimeout)