'Replace existing resource with a new instance.
This can be used in case of defective resources.'

def replace(self, resource):

    if self.limit:
        self._dirty.discard(resource)
    self.close_resource(resource)
