public Result < T > addAttributes ( ServiceInfo . Key key , Attributes attributes ) { T previous = null ; T current = null ; lock ( ) ; try { previous = get ( key ) ; // Updating a service that does not exist must fail (RFC 2608, 9.3) if ( previous == null ) throw new ServiceLocationException ( "Could not find service to update " + key , SLPError . INVALID_UPDATE ) ; current = ( T ) previous . addAttributes ( attributes ) ; keysToServiceInfos . put ( current . getKey ( ) , current ) ; current . setRegistered ( true ) ; previous . setRegistered ( false ) ; } finally { unlock ( ) ; } notifyServiceUpdated ( previous , current ) ; return new Result < T > ( previous , current ) ; }
Updates an existing ServiceInfo identified by the given Key adding the given attributes .