code: public void stop() {
  
  		// return if not running
  
  		if (!running.compareAndSet(true, false)) {
  			return;
  		}
  
  		try {
  			runner.join();
  		} catch (InterruptedException e) {
  			throw new WebcamException("Joint interrupted");
  		}
  
  		LOG.debug("Discovery service has been stopped");
  
  		runner = null;
  	}
docs: Stop discovery service.