class LoadBalancingRpcClient extends AbstractRpcClient {

  @Override
  public void close() throws FlumeException {
    isOpen = false;
    synchronized (this) {
      Iterator<String> it = clientMap.keySet().iterator();
      while (it.hasNext()) {
        String name = it.next();
        RpcClient client = clientMap.get(name);
        if (client != null) {
          try {
            client.close();
          } catch (Exception ex) {
            LOGGER.warn("Failed to close client: " + name, ex);
          }
        }
        it.remove();
      }
    }
  }

}