本文整理汇总了Java中org.apache.htrace.core.HTraceConfiguration.getInt方法的典型用法代码示例。如果您正苦于以下问题:Java HTraceConfiguration.getInt方法的具体用法?Java HTraceConfiguration.getInt怎么用?Java HTraceConfiguration.getInt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.htrace.core.HTraceConfiguration
的用法示例。
在下文中一共展示了HTraceConfiguration.getInt方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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());
}
}
示例2: configure
import org.apache.htrace.core.HTraceConfiguration; //导入方法依赖的package包/类
private void configure(HTraceConfiguration conf) {
this.conf = conf;
// initialize the endpoint. This endpoint is used while writing the Span.
initConverter();
int numThreads = conf.getInt(NUM_THREAD_KEY, DEFAULT_NUM_THREAD);
// If there are already threads runnnig 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());
}
}
示例3: 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");
}
}
示例4: 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());
}
}
示例5: getBoundedInt
import org.apache.htrace.core.HTraceConfiguration; //导入方法依赖的package包/类
private static int getBoundedInt(final HTraceConfiguration conf,
String key, int defaultValue, int minValue, int maxValue) {
int val = conf.getInt(key, defaultValue);
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;
}
示例6: 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);
}