Object property = reference.getProperty(Constants.SERVICE_RANKING);  int newServiceRanking = (property instanceof Integer) ? ((Integer) property).intValue() : 0;  if (!handlerRegistered) {
int newServiceRanking = getRank(reference); if (newServiceRanking > ranking)
	public Object addingService(ServiceReference reference) {		//check to see if our protocol is being registered by another service		Object prop = reference.getProperty(URLConstants.URL_HANDLER_PROTOCOL);		if (!(prop instanceof String[]))			return null;		String[] protocols = (String[]) prop;		for (int i = 0; i < protocols.length; i++) {			if (protocols[i].equals(protocol)) {				//If our protocol is registered by another service, check the service ranking and switch 				//URLStreamHandlers if nessecary.				Object property = reference.getProperty(Constants.SERVICE_RANKING);				int newServiceRanking = (property instanceof Integer) ? ((Integer) property).intValue() : 0;				if (!handlerRegistered) {					setNewHandler(reference, newServiceRanking);					handlerRegistered = true;				}				if (newServiceRanking > ranking) {					setNewHandler(reference, newServiceRanking);				}				return (reference);			}		}		//we don't want to continue hearing events about a URLStreamHandlerService not registered under our protocol		return (null);	}