Java Code Examples for org.apache.flume.FlumeException#getMessage()

The following examples show how to use org.apache.flume.FlumeException#getMessage() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Log4jAppender.java    From mt-flume with Apache License 2.0 6 votes vote down vote up
/**
 * Activate the options set using <tt>setPort()</tt>
 * and <tt>setHostname()</tt>
 *
 * @throws FlumeException if the <tt>hostname</tt> and
 *                        <tt>port</tt> combination is invalid.
 */
@Override
public void activateOptions() throws FlumeException {
  Properties props = new Properties();
  props.setProperty(RpcClientConfigurationConstants.CONFIG_HOSTS, "h1");
  props.setProperty(RpcClientConfigurationConstants.CONFIG_HOSTS_PREFIX + "h1",
    hostname + ":" + port);
  props.setProperty(RpcClientConfigurationConstants.CONFIG_CONNECT_TIMEOUT,
   String.valueOf(timeout));
  props.setProperty(RpcClientConfigurationConstants.CONFIG_REQUEST_TIMEOUT,
    String.valueOf(timeout));
  try {
    rpcClient = RpcClientFactory.getInstance(props);
    if (layout != null) {
      layout.activateOptions();
    }
  } catch (FlumeException e) {
    String errormsg = "RPC client creation failed! " +
      e.getMessage();
    LogLog.error(errormsg);
    if (unsafeMode) {
      return;
    }
    throw e;
  }
}
 
Example 2
Source File: Log4jAppender.java    From kite with Apache License 2.0 6 votes vote down vote up
/**
 * Activate the options set using <tt>setPort()</tt>
 * and <tt>setHostname()</tt>
 * @throws FlumeException if the <tt>hostname</tt> and
 *  <tt>port</tt> combination is invalid.
 */
@Override
public void activateOptions() throws FlumeException {
  Properties props = new Properties();
  props.setProperty(RpcClientConfigurationConstants.CONFIG_HOSTS, "h1");
  props.setProperty(RpcClientConfigurationConstants.CONFIG_HOSTS_PREFIX + "h1",
      hostname + ":" + port);
  props.setProperty(RpcClientConfigurationConstants.CONFIG_CONNECT_TIMEOUT,
      String.valueOf(timeout));
  props.setProperty(RpcClientConfigurationConstants.CONFIG_REQUEST_TIMEOUT,
      String.valueOf(timeout));
  try {
    rpcClient = RpcClientFactory.getInstance(props);
    if (layout != null) {
      layout.activateOptions();
    }
  } catch (FlumeException e) {
    String errormsg = "RPC client creation failed! " +
        e.getMessage();
    LogLog.error(errormsg);
    throw e;
  }
}
 
Example 3
Source File: LoadBalancingLog4jAppender.java    From kite with Apache License 2.0 5 votes vote down vote up
/**
 * Activate the options set using <tt>setHosts()</tt>, <tt>setSelector</tt>
 * and <tt>setMaxBackoff</tt>
 *
 * @throws FlumeException
 *           if the LoadBalancingRpcClient cannot be instantiated.
 */
@Override
public void activateOptions() throws FlumeException {
  try {
    final Properties properties = getProperties(hosts, selector, maxBackoff);
    rpcClient = RpcClientFactory.getInstance(properties);
  } catch (FlumeException e) {
    String errormsg = "RPC client creation failed! " + e.getMessage();
    LogLog.error(errormsg);
    throw e;
  }
}