@Test public void testTwoParamDeprecatedAppend() throws FlumeException, EventDeliveryException { RpcClient client = null; Server server = RpcTestUtils.startServer(new OKAvroHandler()); try { client = RpcClientFactory.getInstance(localhost, server.getPort()); client.append(EventBuilder.withBody("wheee!!!", Charset.forName("UTF8"))); } finally { RpcTestUtils.stopServer(server); if (client != null) client.close(); } }
@SuppressWarnings("unchecked") public static RpcClient getInstance(Properties properties) throws FlumeException { String type = null; type = properties.getProperty( RpcClientConfigurationConstants.CONFIG_CLIENT_TYPE); if (type == null || type.isEmpty()) { type = ClientType.DEFAULT.getClientClassName(); } Class<? extends AbstractRpcClient> clazz; AbstractRpcClient client; try { String clientClassType = type; ClientType clientType = null; try{ clientType = ClientType.valueOf(type.toUpperCase()); } catch (IllegalArgumentException e){ clientType = ClientType.OTHER; } if (!clientType.equals(ClientType.OTHER)){ clientClassType = clientType.getClientClassName(); } clazz = (Class<? extends AbstractRpcClient>) Class.forName(clientClassType); } catch (ClassNotFoundException e) { throw new FlumeException("No such client!", e); } try { client = clazz.newInstance(); } catch (InstantiationException e) { throw new FlumeException("Cannot instantiate client. " + "Exception follows:", e); } catch (IllegalAccessException e) { throw new FlumeException("Cannot instantiate client. " + "Exception follows:", e); } client.configure(properties); return client; }
RpcClientFactory { @SuppressWarnings("unchecked") public static RpcClient getInstance(Properties properties) throws FlumeException { String type = null; type = properties.getProperty( RpcClientConfigurationConstants.CONFIG_CLIENT_TYPE); if (type == null || type.isEmpty()) { type = ClientType.DEFAULT.getClientClassName(); } Class<? extends AbstractRpcClient> clazz; AbstractRpcClient client; try { String clientClassType = type; ClientType clientType = null; try{ clientType = ClientType.valueOf(type.toUpperCase()); } catch (IllegalArgumentException e){ clientType = ClientType.OTHER; } if (!clientType.equals(ClientType.OTHER)){ clientClassType = clientType.getClientClassName(); } clazz = (Class<? extends AbstractRpcClient>) Class.forName(clientClassType); } catch (ClassNotFoundException e) { throw new FlumeException("No such client!", e); } try { client = clazz.newInstance(); } catch (InstantiationException e) { throw new FlumeException("Cannot instantiate client. " + "Exception follows:", e); } catch (IllegalAccessException e) { throw new FlumeException("Cannot instantiate client. " + "Exception follows:", e); } client.configure(properties); return client; } }
RpcClientFactory { @SuppressWarnings("unchecked") public static RpcClient getInstance(Properties properties) throws FlumeException { String type = null; type = properties.getProperty( RpcClientConfigurationConstants.CONFIG_CLIENT_TYPE); if (type == null || type.isEmpty()) { type = ClientType.DEFAULT.getClientClassName(); } Class<? extends AbstractRpcClient> clazz; AbstractRpcClient client; try { String clientClassType = type; ClientType clientType = null; try{ clientType = ClientType.valueOf(type.toUpperCase()); } catch (IllegalArgumentException e){ clientType = ClientType.OTHER; } if (!clientType.equals(ClientType.OTHER)){ clientClassType = clientType.getClientClassName(); } clazz = (Class<? extends AbstractRpcClient>) Class.forName(clientClassType); } catch (ClassNotFoundException e) { throw new FlumeException("No such client!", e); } try { client = clazz.newInstance(); } catch (InstantiationException e) { throw new FlumeException("Cannot instantiate client. " + "Exception follows:", e); } catch (IllegalAccessException e) { throw new FlumeException("Cannot instantiate client. " + "Exception follows:", e); } client.configure(properties); return client; }  }
RpcClientFactory { @SuppressWarnings("unchecked") public static RpcClient getInstance(Properties properties) throws FlumeException { String type = null; type = properties.getProperty( RpcClientConfigurationConstants.CONFIG_CLIENT_TYPE); if (type == null || type.isEmpty()) { type = ClientType.DEFAULT.getClientClassName(); } Class<? extends AbstractRpcClient> clazz; AbstractRpcClient client; try { String clientClassType = type; ClientType clientType = null; try{ clientType = ClientType.valueOf(type.toUpperCase()); } catch (IllegalArgumentException e){ clientType = ClientType.OTHER; } if (!clientType.equals(ClientType.OTHER)){ clientClassType = clientType.getClientClassName(); } clazz = (Class<? extends AbstractRpcClient>) Class.forName(clientClassType); } catch (ClassNotFoundException e) { throw new FlumeException("No such client!", e); } try { client = clazz.newInstance(); } catch (InstantiationException e) { throw new FlumeException("Cannot instantiate client. " + "Exception follows:", e); } catch (IllegalAccessException e) { throw new FlumeException("Cannot instantiate client. " + "Exception follows:", e); } client.configure(properties); return client; }  @SuppressWarnings("unchecked") static RpcClient getInstance(Properties properties); static RpcClient getInstance(File propertiesFile); @Deprecated static RpcClient getInstance(String hostname, Integer port); static RpcClient getDefaultInstance(String hostname, Integer port); @Deprecated static RpcClient getInstance(String hostname, Integer port,
      Integer batchSize); static RpcClient getDefaultInstance(String hostname, Integer port,
      Integer batchSize); static RpcClient getThriftInstance(String hostname, Integer port,
    Integer batchSize); static RpcClient getThriftInstance(String hostname, Integer port); static RpcClient getThriftInstance(Properties props); }
RpcClientFactory { @SuppressWarnings("unchecked") public static RpcClient getInstance(Properties properties) throws FlumeException { String type = null; type = properties.getProperty( RpcClientConfigurationConstants.CONFIG_CLIENT_TYPE); if (type == null || type.isEmpty()) { type = ClientType.DEFAULT.getClientClassName(); } Class<? extends AbstractRpcClient> clazz; AbstractRpcClient client; try { String clientClassType = type; ClientType clientType = null; try{ clientType = ClientType.valueOf(type.toUpperCase()); } catch (IllegalArgumentException e){ clientType = ClientType.OTHER; } if (!clientType.equals(ClientType.OTHER)){ clientClassType = clientType.getClientClassName(); } clazz = (Class<? extends AbstractRpcClient>) Class.forName(clientClassType); } catch (ClassNotFoundException e) { throw new FlumeException("No such client!", e); } try { client = clazz.newInstance(); } catch (InstantiationException e) { throw new FlumeException("Cannot instantiate client. " + "Exception follows:", e); } catch (IllegalAccessException e) { throw new FlumeException("Cannot instantiate client. " + "Exception follows:", e); } client.configure(properties); return client; }  @SuppressWarnings("unchecked") static RpcClient getInstance(Properties properties); static RpcClient getInstance(File propertiesFile); @Deprecated static RpcClient getInstance(String hostname, Integer port); static RpcClient getDefaultInstance(String hostname, Integer port); @Deprecated static RpcClient getInstance(String hostname, Integer port,
      Integer batchSize); static RpcClient getDefaultInstance(String hostname, Integer port,
      Integer batchSize); static RpcClient getThriftInstance(String hostname, Integer port,
    Integer batchSize); static RpcClient getThriftInstance(String hostname, Integer port); static RpcClient getThriftInstance(Properties props);  }