core/src/main/java/org/mobicents/ha/javax/sip/LoadBalancerHeartBeatingServiceImpl.java
public boolean removeBalancer(String addr, int sipPort, int httpPort, int rmiPort) {
		if (addr == null)
			throw new NullPointerException("addr cant be null!!!");

		InetAddress address = null;
		try {
			address = InetAddress.getByName(addr);
		} catch (UnknownHostException e) {
			throw new IllegalArgumentException(
					"Something wrong with host creation.", e);
		}

		SipLoadBalancer sipLoadBalancer = new SipLoadBalancer(this, address, sipPort, httpPort, rmiPort);

		String keyToRemove = null;
		Iterator<String> keyIterator = register.keySet().iterator();
		while (keyIterator.hasNext() && keyToRemove ==null) {
			String key = keyIterator.next();
			if(register.get(key).equals(sipLoadBalancer)) {
				keyToRemove = key;
			}
		}
		
		if(keyToRemove !=null ) {			
			register.remove(keyToRemove);
			
			// notify the listeners
			for (LoadBalancerHeartBeatingListener loadBalancerHeartBeatingListener : loadBalancerHeartBeatingListeners) {
				loadBalancerHeartBeatingListener.loadBalancerRemoved(sipLoadBalancer);
			}
			
			if(logger.isLoggingEnabled(StackLogger.TRACE_DEBUG)) {
				logger.logDebug("following balancer name : " + keyToRemove +"/address:"+ addr + " removed");
			}
			
			return true;
		}

		return false;
	}
public boolean removeBalancer(String addr, int sipPort, int httpPort, int rmiPort) {
		if (addr == null)
			throw new NullPointerException("addr cant be null!!!");

		InetAddress address = null;
		try {
			address = InetAddress.getByName(addr);
		} catch (UnknownHostException e) {
			throw new IllegalArgumentException(
					"Something wrong with host creation.", e);
		}

		SipLoadBalancer sipLoadBalancer = new SipLoadBalancer(this, address, sipPort, httpPort, rmiPort);

		String keyToRemove = null;
		Iterator<String> keyIterator = register.keySet().iterator();
		while (keyIterator.hasNext() && keyToRemove ==null) {
			String key = keyIterator.next();
			if(register.get(key).equals(sipLoadBalancer)) {
				keyToRemove = key;
			}
		}
		
		if(keyToRemove !=null ) {			
			register.remove(keyToRemove);
			
			// notify the listeners
			for (LoadBalancerHeartBeatingListener loadBalancerHeartBeatingListener : loadBalancerHeartBeatingListeners) {
				loadBalancerHeartBeatingListener.loadBalancerRemoved(sipLoadBalancer);
			}
			
			if(logger.isLoggingEnabled(StackLogger.TRACE_DEBUG)) {
				logger.logDebug("following balancer name : " + keyToRemove +"/address:"+ addr + " removed");
			}
			
			return true;
		}

		return false;
	}
public boolean removeBalancer ( String addr , int sipPort , int httpPort , int rmiPort ) { if ( addr == null ) throw new NullPointerException ( "addr cant be null!!!" ) ; InetAddress address = null ; try { address = InetAddress . getByName ( addr ) ; } catch ( UnknownHostException e ) { throw new IllegalArgumentException ( "Something wrong with host creation." , e ) ; } SipLoadBalancer sipLoadBalancer = new SipLoadBalancer ( this , address , sipPort , httpPort , rmiPort ) ; String keyToRemove = null ; Iterator < String > keyIterator = register . keySet ( ) . iterator ( ) ; while ( keyIterator . hasNext ( ) && keyToRemove == null ) { String key = keyIterator . next ( ) ; if ( register . get ( key ) . equals ( sipLoadBalancer ) ) { keyToRemove = key ; } } if ( keyToRemove != null ) { register . remove ( keyToRemove ) ; // notify the listeners for ( LoadBalancerHeartBeatingListener loadBalancerHeartBeatingListener : loadBalancerHeartBeatingListeners ) { loadBalancerHeartBeatingListener . loadBalancerRemoved ( sipLoadBalancer ) ; } if ( logger . isLoggingEnabled ( StackLogger . TRACE_DEBUG ) ) { logger . logDebug ( "following balancer name : " + keyToRemove + "/address:" + addr + " removed" ) ; } return true ; } return false ; }
{@inheritDoc}
{