tag::service-unavailable[]
488539
public boolean addItem()
    {
        try ( Session session = driver.session() )
        {
            return session.writeTransaction( new TransactionWork<Boolean>()
            {
                @Override
                public Boolean execute( Transaction tx )
                {
                    tx.run( "CREATE (a:Item)" );
                    return true;
                }
            } );
        }
        catch ( ServiceUnavailableException ex )
        {
            return false;
        }
    }
644250
def fetch(services)
      unless [String, Array].include?(services.class)
        raise ArgumentError, "Service(s) argument required"
      end
      
      results = {}
      names   = [services].flatten
      
      if names.empty?
        raise ArgumentError, "Service(s) argument required"
      end
      
      names.each do |service|
        begin
          connection.send_data("fetch #{service}")
          lines = connection.read_packet
          results[service] =  parse_fetch(lines)
        rescue UnknownService, BadExit
          # TODO
        end
      end
      results
    end
1182875
public void addTangoUserListener(ITangoUserListener listener, String attrName, String[] filters)
            throws DevFailed {
        addTangoUserListener(listener, attrName, filters, false);
    }
507293
@Override
    protected HttpResponse onFailure(ServiceRequestContext ctx, HttpRequest req, @Nullable Throwable cause)
            throws Exception {
        return HttpResponse.of(HttpStatus.SERVICE_UNAVAILABLE);
    }
937010
def service_absent(name, namespace='default', **kwargs):
    '''
    
    '''

    ret = {'name': name,
           'changes': {},
           'result': False,
           'comment': ''}

    service = __salt__['kubernetes.show_service'](name, namespace, **kwargs)

    if service is None:
        ret['result'] = True if not __opts__['test'] else None
        ret['comment'] = 'The service does not exist'
        return ret

    if __opts__['test']:
        ret['comment'] = 'The service is going to be deleted'
        ret['result'] = None
        return ret

    res = __salt__['kubernetes.delete_service'](name, namespace, **kwargs)
    if res['code'] == 200:
        ret['result'] = True
        ret['changes'] = {
            'kubernetes.service': {
                'new': 'absent', 'old': 'present'}}
        ret['comment'] = res['message']
    else:
        ret['comment'] = 'Something went wrong, response: {0}'.format(res)

    return ret
121567
public function getTagged($tag)
	{
		$services = array();

		if (isset($this->tags[$tag]))
		{
			foreach ($this->tags[$tag] as $service)
			{
				$services[] = $this->get($service);
			}
		}

		return $services;
	}
1168597
protected function findTags(ContainerBuilder $container, $tagName, $argumentPosition, $ext = false): void
    {
        $services = [];

        foreach ($container->findTaggedServiceIds($tagName) as $serviceId => $tag) {
            $class = isset($tag[0]['class'])
                ? $this->getRealClassName($container, $tag[0]['class'])
                : $this->getClassName($container, $serviceId, $tagName);
            $class = $this->findResolveTarget($container, $class);
            $this->replaceResolveTargetClass($container, $tagName, $serviceId, $class);

            // Flip, because we want tag classe names (= type identifiers) as keys
            if ($ext) {
                $services[$class][] = $serviceId;
            } else {
                $services[$class] = $serviceId;
            }
        }

        $container->getDefinition('fxp_default_value.extension')->replaceArgument($argumentPosition, $services);
    }
1221972
public function getServicesByTag($tag, $forceType = null)
    {
        $services = [];
        foreach ($this->taggedServices->key($tag, [], true) as $serviceName) {
            $service = $this->getService($serviceName);
            if (!$this->isNull($forceType) && !$this->isInstanceOf($service, $forceType)) {
                continue;
            }
            $services[$serviceName] = $service;
        }

        return $services;
    }
220576
public function findTaggedServices($tag, $orderByPriority = true)
    {
        $services = [];
        if (array_key_exists($tag, $this->servicesByTags)) {
            $services = $this->servicesByTags[$tag];
        }

        if ($orderByPriority) {
            $this->sortByPriority($services);
        }

        return $services;
    }
476323
public function addByArray(array $services = [])
  {
    if (!empty($services)) {
      foreach ($services as $name => $methods) {
        if (!$this->has($name)) {
          $service = new Service();

          foreach ($methods as $method => $value) {
            if (method_exists($service, $method)) {
              $service->{$method}($value);
            } else {
                throw new ServiceMethodNotExists(sprintf(
                  "Method '%s' does not exists on the %s service.",
                  $method,
                  $name
                ));
              }
          }

          $this->services[$name] = $service;

          continue;
        }

        throw new ServiceAlreadyExists(sprintf(
          "Service '%s' already exists.",
          $name
        ));
      }
    }

    return $this;
  }
493283
@Override
  public boolean service(RequestBaratine request)
  {
    request.status(HttpStatus.NOT_FOUND);
    
    request.write("Not found: " + request.uri() + "\n");
    request.ok();
    
    return true;
  }
1105039
def check_option_validity
      if @hold && !@array_names.empty?
        puts "ERROR: Holding of array objects is not yet supported"
        exit 1
      end

      if @tags.empty? and @array_names.empty? and @deployment_names.empty? and not @chimpd_wait_until_done
        puts "ERROR: Please select the objects to operate upon."
        help
        exit 1
      end

      if not @array_names.empty? and ( not @tags.empty? or not @deployment_names.empty? )
        puts "ERROR: You cannot mix ServerArray queries with other types of queries."
        help
        exit 1
      end
    end
1243404
@Override
  @ExperimentalApi("https://github.com/grpc/grpc-java/issues/2222")
  public List<ServerServiceDefinition> getServices() {
    return Collections.unmodifiableList(new ArrayList<>(services.values()));
  }
740975
@Override
    public void add(final S service)
    {
        if(service == null)
        {
            throw new NullPointerException("Service must not be null");
        }
        
        final K key = this.getKey(service);
        
        if(key == null)
        {
            throw new NullPointerException("Key for service must not be null");
        }
        
        Collection<S> set = this.services.get(key);
        
        set.add(service);
        
        if(set.size() != 1)
        {
            this.log.error("Failing due to a duplicate service with key: {} for class {}", key, service);
            throw new ServiceConfigurationError("Found a duplicate service with key: " + key + " for class: " + service);
        }
        
        if(this.log.isDebugEnabled())
        {
            this.log.debug("Added service with key: {}", key);
        }
    }
927172
def services(device_id=nil, shared=false)
      params = { shared: shared }
      params[:deviceid] = device_id unless device_id.nil?

      response = get('/listServices', params)
      services = []
      response.body['services'].each do |s|
        services << Service.from_json(s, @token, @logger)
      end
      services
    end
593015
public function getTaggedServices($tagName)
    {
        $taggedServices = [];
        foreach ($this->getApp()->container->all() as $serviceName => $serviceDefinition) {
            if (!$serviceDefinition instanceof ServiceDefinition) {
                continue;
            }

            if (in_array($tagName, $serviceDefinition->getTags()->keys())) {
                $taggedServices['@' . $serviceDefinition->getServiceName()] = $serviceDefinition;
            }
        }

        return $taggedServices;
    }
144536
function(service) {

		// If the service doesn't exist
		service = service || this.settings.default_service;

		if (!service || !(service in this.services)) {
			return null;
		}

		return this.utils.store(service) || null;
	}