Log4jAppender.java 文件源码

java
阅读 28 收藏 0 点赞 0 评论 0

项目:flume-release-1.7.0 作者:
/**
 * 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;
  }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号