'If this is the last reference to a hostname, remove. This requires a host def lock wrapping'

def _stopAndClearUniqueHost(self, hostname):

    try:
        self.serverUniqueHostsLock.acquire()
        foundCount = 0
        for hostKey in self.serverHostDefs.keys():
            if (self.serverHostDefs[hostKey]['hostname'] == hostname):
                foundCount = (foundCount + 1)
        if ((foundCount <= 1) and (hostname in self.serverUniqueHosts)):
            self.serverUniqueHosts[hostname].stopThread()
            del self.serverUniqueHosts[hostname]
    finally:
        self.serverUniqueHostsLock.release()
