@Test(expected=FlumeException.class) public void testCreatingLbClientSingleHost() { Server server1 = null; RpcClient c = null; try { server1 = RpcTestUtils.startServer(new OKAvroHandler()); Properties p = new Properties(); p.put("host1", "127.0.0.1:" + server1.getPort()); p.put("hosts", "host1"); p.put("client.type", "default_loadbalance"); RpcClientFactory.getInstance(p); } finally { if (server1 != null) server1.close(); if (c != null) c.close(); } }
@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(); } } }
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(); } } } }
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(); } } }  }
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(); } } }  @Override void append(Event event); @Override void appendBatch(List<Event> events); @Override boolean isActive(); @Override void close(); }
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(); } } }  @Override void append(Event event); @Override void appendBatch(List<Event> events); @Override boolean isActive(); @Override void close();  }