当前位置: 首页>>代码示例>>Java>>正文


Java HTraceConfiguration.get方法代码示例

本文整理汇总了Java中org.apache.htrace.core.HTraceConfiguration.get方法的典型用法代码示例。如果您正苦于以下问题:Java HTraceConfiguration.get方法的具体用法?Java HTraceConfiguration.get怎么用?Java HTraceConfiguration.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.htrace.core.HTraceConfiguration的用法示例。


在下文中一共展示了HTraceConfiguration.get方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: HBaseSpanReceiver

import org.apache.htrace.core.HTraceConfiguration; //导入方法依赖的package包/类
public HBaseSpanReceiver(HTraceConfiguration conf) {
  this.queue = new ArrayBlockingQueue<Span>(1000);
  this.hconf = HBaseConfiguration.create();
  this.table = Bytes.toBytes(conf.get(TABLE_KEY, DEFAULT_TABLE));
  this.cf = Bytes.toBytes(conf.get(COLUMNFAMILY_KEY, DEFAULT_COLUMNFAMILY));
  this.icf = Bytes.toBytes(conf.get(INDEXFAMILY_KEY, DEFAULT_INDEXFAMILY));
  this.maxSpanBatchSize = conf.getInt(MAX_SPAN_BATCH_SIZE_KEY,
                                      DEFAULT_MAX_SPAN_BATCH_SIZE);
  String quorum = conf.get(COLLECTOR_QUORUM_KEY, DEFAULT_COLLECTOR_QUORUM);
  hconf.set(HConstants.ZOOKEEPER_QUORUM, quorum);
  String znodeParent = conf.get(ZOOKEEPER_ZNODE_PARENT_KEY, DEFAULT_ZOOKEEPER_ZNODE_PARENT);
  hconf.set(HConstants.ZOOKEEPER_ZNODE_PARENT, znodeParent);
  int clientPort = conf.getInt(ZOOKEEPER_CLIENT_PORT_KEY, DEFAULT_ZOOKEEPER_CLIENT_PORT);
  hconf.setInt(HConstants.ZOOKEEPER_CLIENT_PORT, clientPort);

  // If there are already threads runnnig tear them down.
  if (this.service != null) {
    this.service.shutdownNow();
    this.service = null;
  }
  int numThreads = conf.getInt(NUM_THREADS_KEY, DEFAULT_NUM_THREADS);
  this.service = Executors.newFixedThreadPool(numThreads, tf);
  for (int i = 0; i < numThreads; i++) {
    this.service.submit(new WriteSpanRunnable());
  }
}
 
开发者ID:apache,项目名称:incubator-htrace,代码行数:27,代码来源:HBaseSpanReceiver.java

示例2: open

import org.apache.htrace.core.HTraceConfiguration; //导入方法依赖的package包/类
@Override
public void open(HTraceConfiguration conf) throws IOException {
  if (!isOpen()) {
    checkDeprecation(conf, DEPRECATED_HOSTNAME_KEY, HOSTNAME_KEY);
    checkDeprecation(conf, DEPRECATED_PORT_KEY, PORT_KEY);

    String collectorHostname = conf.get(HOSTNAME_KEY,
                                        conf.get(DEPRECATED_HOSTNAME_KEY,
                                                 DEFAULT_COLLECTOR_HOSTNAME));
    int collectorPort = conf.getInt(PORT_KEY,
                                    conf.getInt(DEPRECATED_PORT_KEY,
                                                DEFAULT_COLLECTOR_PORT));
    scribe = newScribe(collectorHostname, collectorPort);
    LOG.info("Opened transport " + collectorHostname + ":" + collectorPort);
  } else {
    LOG.warn("Attempted to open an already opened transport");
  }
}
 
开发者ID:apache,项目名称:incubator-htrace,代码行数:19,代码来源:ScribeTransport.java

示例3: configure

import org.apache.htrace.core.HTraceConfiguration; //导入方法依赖的package包/类
private void configure (HTraceConfiguration conf) {

    // Read configuration
    int numThreads = conf.getInt(NUM_THREADS_KEY, DEFAULT_NUM_THREADS);
    this.flumeHostName = conf.get(FLUME_HOSTNAME_KEY, DEFAULT_FLUME_HOSTNAME);
    this.flumePort = conf.getInt(FLUME_PORT_KEY, 0);
    if (this.flumePort == 0) {
      throw new IllegalArgumentException(FLUME_PORT_KEY + " is required in configuration.");
    }
    this.maxSpanBatchSize = conf.getInt(FLUME_BATCHSIZE_KEY, DEFAULT_FLUME_BATCHSIZE);

    // Initialize executors
    // If there are already threads running tear them down.
    if (this.service != null) {
      this.service.shutdownNow();
      this.service = null;
    }
    this.service = Executors.newFixedThreadPool(numThreads, tf);
    for (int i = 0; i < numThreads; i++) {
      this.service.submit(new WriteSpanRunnable());
    }
  }
 
开发者ID:apache,项目名称:incubator-htrace,代码行数:23,代码来源:FlumeSpanReceiver.java

示例4: getBoundedLong

import org.apache.htrace.core.HTraceConfiguration; //导入方法依赖的package包/类
private static long getBoundedLong(final HTraceConfiguration conf,
      String key, long defaultValue, long minValue, long maxValue) {
  String strVal = conf.get(key, Long.toString(defaultValue));
  long val = 0;
  try {
    val = Long.parseLong(strVal);
  } catch (NumberFormatException nfe) {
    throw new IllegalArgumentException("Bad value for '" + key +
      "': should be long");
  }
  if (val < minValue) {
    LOG.warn("Can't set " + key + " to " + val + ".  Using minimum value " +
        "of " + minValue + " instead.");
    return minValue;
  } else if (val > maxValue) {
    LOG.warn("Can't set " + key + " to " + val + ".  Using maximum value " +
        "of " + maxValue + " instead.");
    return maxValue;
  }
  return val;
}
 
开发者ID:apache,项目名称:incubator-htrace,代码行数:22,代码来源:Conf.java

示例5: getBoundedDouble

import org.apache.htrace.core.HTraceConfiguration; //导入方法依赖的package包/类
private static double getBoundedDouble(final HTraceConfiguration conf,
      String key, double defaultValue, double minValue, double maxValue) {
  String strVal = conf.get(key, Double.toString(defaultValue));
  double val = 0;
  try {
    val = Double.parseDouble(strVal);
  } catch (NumberFormatException nfe) {
    throw new IllegalArgumentException("Bad value for '" + key +
      "': should be double");
  }
  if (val < minValue) {
    LOG.warn("Can't set " + key + " to " + val + ".  Using minimum value " +
        "of " + minValue + " instead.");
    return minValue;
  }
  if (val > maxValue) {
    LOG.warn("Can't set " + key + " to " + val + ".  Using maximum value " +
        "of " + maxValue + " instead.");
    return maxValue;
  }
  return val;
}
 
开发者ID:apache,项目名称:incubator-htrace,代码行数:23,代码来源:Conf.java

示例6: createTransport

import org.apache.htrace.core.HTraceConfiguration; //导入方法依赖的package包/类
protected Transport createTransport(HTraceConfiguration conf) {
  ClassLoader classLoader = Builder.class.getClassLoader();
  String className = conf.get(TRANSPORT_CLASS_KEY, DEFAULT_TRANSPORT_CLASS);
  Transport transport = null;
  try {
    Class<?> cls = classLoader.loadClass(className);
    transport = (Transport)cls.newInstance();
  } catch (ClassNotFoundException
      | InstantiationException
      | IllegalAccessException e) {
    logAndThrow(e);
  }
  return transport;
}
 
开发者ID:apache,项目名称:incubator-htrace,代码行数:15,代码来源:ZipkinSpanReceiver.java

示例7: open

import org.apache.htrace.core.HTraceConfiguration; //导入方法依赖的package包/类
/**
 * Opens a new Kafka transport
 * @param conf Transport configuration. Some Kafka producer configurations
 *             can be passed by prefixing the config key with zipkin.kafka
 *             (e.g. zipkin.kafka.producer.type for producer.type)
 * @throws IOException if an I/O error occurs
 * @throws IllegalStateException if transport is already open
 */
@Override
public void open(HTraceConfiguration conf) throws IOException,
                                                  IllegalStateException {
  if (!isOpen()) {
    topic = conf.get(TOPIC_KEY, DEFAULT_TOPIC);
    producer = newProducer(conf);
    isOpen = true;
  } else {
    LOG.warn("Attempted to open an already opened transport");
  }
}
 
开发者ID:apache,项目名称:incubator-htrace,代码行数:20,代码来源:KafkaTransport.java

示例8: checkDeprecation

import org.apache.htrace.core.HTraceConfiguration; //导入方法依赖的package包/类
private void checkDeprecation(HTraceConfiguration conf, String deprecatedKey,
                              String newKey) {
  if (conf.get(deprecatedKey) != null) {
    LOG.warn("Configuration \"" + deprecatedKey + "\" is deprecated. Use \"" +
             newKey + "\" instead.");
  }
}
 
开发者ID:apache,项目名称:incubator-htrace,代码行数:8,代码来源:ScribeTransport.java

示例9: Conf

import org.apache.htrace.core.HTraceConfiguration; //导入方法依赖的package包/类
Conf(HTraceConfiguration conf) throws IOException {
  this.ioTimeoutMs = getBoundedInt(conf, IO_TIMEOUT_MS_KEY,
            IO_TIMEOUT_MS_DEFAULT,
            IO_TIMEOUT_MS_MIN, Integer.MAX_VALUE);
  this.connectTimeoutMs = getBoundedInt(conf, CONNECT_TIMEOUT_MS_KEY,
            CONNECT_TIMEOUT_MS_DEFAULT,
            CONNECT_TIMEOUT_MS_MIN, Integer.MAX_VALUE);
  this.idleTimeoutMs = getBoundedInt(conf, IDLE_TIMEOUT_MS_KEY,
            IDLE_TIMEOUT_MS_DEFAULT,
            IDLE_TIMEOUT_MS_MIN, Integer.MAX_VALUE);
  this.flushRetryDelays = getIntArray(conf.get(FLUSH_RETRY_DELAYS_KEY,
            FLUSH_RETRY_DELAYS_DEFAULT));
  this.maxFlushIntervalMs = getBoundedInt(conf, MAX_FLUSH_INTERVAL_MS_KEY,
            MAX_FLUSH_INTERVAL_MS_DEFAULT,
            MAX_FLUSH_INTERVAL_MS_MIN, Integer.MAX_VALUE);
  this.packed = conf.getBoolean(PACKED_KEY, PACKED_DEFAULT);
  this.bufferSize = getBoundedInt(conf, BUFFER_SIZE_KEY,
            BUFFER_SIZE_DEFAULT,
            BUFFER_SIZE_MIN, BUFFER_SIZE_MAX);
  double triggerFraction = getBoundedDouble(conf,
            BUFFER_SEND_TRIGGER_FRACTION_KEY,
            BUFFER_SEND_TRIGGER_FRACTION_DEFAULT,
            BUFFER_SEND_TRIGGER_FRACTION_MIN, 1.0);
  this.spanDropTimeoutMs = conf.getInt(SPAN_DROP_TIMEOUT_MS_KEY,
      SPAN_DROP_TIMEOUT_MS_DEFAULT);
  this.errorLogPeriodMs = getBoundedLong(conf, ERROR_LOG_PERIOD_MS_KEY,
      ERROR_LOG_PERIOD_MS_DEFAULT, 0, Long.MAX_VALUE);
  this.triggerSize = (int)(this.bufferSize * triggerFraction);
  try {
    this.endpointStr = conf.get(ADDRESS_KEY, "");
    this.endpoint = parseHostPortPair(endpointStr);
  } catch (IOException e) {
    throw new IOException("Error reading " + ADDRESS_KEY + ": " +
        e.getMessage());
  }
  this.droppedSpansLogPath = conf.get(
      DROPPED_SPANS_LOG_PATH_KEY, DROPPED_SPANS_LOG_PATH_DEFAULT);
  this.droppedSpansLogMaxSize = getBoundedLong(conf,
      DROPPED_SPANS_LOG_MAX_SIZE_KEY, DROPPED_SPANS_LOG_MAX_SIZE_DEFAULT,
      0, Long.MAX_VALUE);
}
 
开发者ID:apache,项目名称:incubator-htrace,代码行数:42,代码来源:Conf.java


注:本文中的org.apache.htrace.core.HTraceConfiguration.get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。