code: protected ServiceInfoCache.Result<ServiceInfo> uncacheService(ServiceInfo service, boolean update)
      {
          // RFC 2608, 7.0
          if (!scopes.match(service.getScopes()))
          {
              if (logger.isLoggable(Level.FINE))
                  logger.fine("Could not deregister service " + service + ", DirectoryAgent scopes " + scopes + " do not match with service scopes " + service.getScopes());
              throw new ServiceLocationException("Could not deregister service " + service, SLPError.SCOPE_NOT_SUPPORTED);
          }
  
          if (update)
          {
              ServiceInfoCache.Result<ServiceInfo> result = services.removeAttributes(service.getKey(), service.getAttributes());
              if (logger.isLoggable(Level.FINE))
                  logger.fine("Removed attributes " + service + " from service " + result.getPrevious() + ", result is: " + result.getCurrent());
              return result;
          }
          else
          {
              ServiceInfoCache.Result<ServiceInfo> result = services.remove(service.getKey());
              if (logger.isLoggable(Level.FINE))
                  logger.fine("Deregistered service " + result.getPrevious());
              return result;
          }
      }
docs: Removes or updates a previously cached service (if any) with the given service.
  
  @param service the new service
  @param update  whether the given service removes or updates a previously cached service
  @return a structure containing the previous service and the current service (if any)