public boolean addReference ( ServiceReference < T > reference ) { if ( reference == null ) return false ; ConcurrentServiceReferenceElement < T > element = new ConcurrentServiceReferenceElement < T > ( referenceName , reference ) ; synchronized ( elementMap ) { ConcurrentServiceReferenceElement < T > oldElement = elementMap . put ( reference , element ) ; if ( oldElement != null ) { if ( ! element . getRanking ( ) . equals ( oldElement . getRanking ( ) ) ) { elementSetUnsorted = true ; } return true ; } elementSet . add ( element ) ; } return false ; }
Adds the service reference to the set or notifies the set that the service ranking for the reference might have been updated .