You are here

public function Apache_Solr_Service_Balancer::removeWriteService in Apache Solr Search 5

Removes a service instance or descriptor from the available services

Parameters

mixed $service:

Throws

Exception If service descriptor is not valid

1 call to Apache_Solr_Service_Balancer::removeWriteService()
Apache_Solr_Service_Balancer::_selectWriteService in SolrPhpClient/Apache/Solr/Service/Balancer.php
Iterate through available write services and select the first with a ping that satisfies configured timeout restrictions (or the default)

File

SolrPhpClient/Apache/Solr/Service/Balancer.php, line 240

Class

Apache_Solr_Service_Balancer
Reference Implementation for using multiple Solr services in a distribution. Functionality includes: routing of read / write operations failover (on selection) for multiple read servers

Code

public function removeWriteService($service) {
  $id = '';
  if ($service instanceof Apache_Solr_Service) {
    $id = $this
      ->_getServiceId($service
      ->getHost(), $service
      ->getPort(), $service
      ->getPath());
  }
  else {
    if (is_array($service)) {
      if (isset($service['host']) && isset($service['port']) && isset($service['path'])) {
        $id = $this
          ->_getServiceId((string) $service['host'], (int) $service['port'], (string) $service['path']);
      }
      else {
        throw new Exception('A Readable Service description array does not have all required elements of host, port, and path');
      }
    }
    else {
      if (is_string($service)) {
        $id = $service;
      }
    }
  }
  if ($id && isset($this->_writeableServices[$id])) {
    unset($this->_writeableServices[$id]);
  }
}