本文整理汇总了Java中com.lmax.disruptor.util.Util.ceilingNextPowerOfTwo方法的典型用法代码示例。如果您正苦于以下问题:Java Util.ceilingNextPowerOfTwo方法的具体用法?Java Util.ceilingNextPowerOfTwo怎么用?Java Util.ceilingNextPowerOfTwo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.lmax.disruptor.util.Util
的用法示例。
在下文中一共展示了Util.ceilingNextPowerOfTwo方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: AuditReporter
import com.lmax.disruptor.util.Util; //导入方法依赖的package包/类
AuditReporter(int queueSize, long timeBucketIntervalInSec, int reportFreqMsgCount, int reportFreqIntervalSec,
boolean combineMetricsAmongHosts) {
reportExecutor =
Executors.newSingleThreadExecutor(new ThreadFactoryBuilder().setNameFormat(getType() + "-audit-reporter-%d")
.build());;
queueSize = Util.ceilingNextPowerOfTwo(queueSize);
disruptor = new Disruptor<AuditMsgReportTask>(new AuditMsgReportTaskFactory(), queueSize, reportExecutor);
disruptor.handleEventsWith(new AuditMsgReportTaskHandler(this));
ringBuffer = disruptor.getRingBuffer();
aggregator =
new AuditAggregator(timeBucketIntervalInSec, reportFreqMsgCount, reportFreqIntervalSec,
combineMetricsAmongHosts);
SUBMITTED_COUNTER = Metrics.getRegistry().meter(getType() + ".auditReporter.submittedNumber");
FAILED_TO_SUBMIT_COUNTER = Metrics.getRegistry().meter(getType() + ".auditReporter.failedToSubmitNumber");
REPORTED_COUNTER = Metrics.getRegistry().meter(getType() + ".auditReporter.reportedNumber");
FAILED_TO_REPORT_COUNTER = Metrics.getRegistry().meter(getType() + ".auditReporter.failedToReportNumber");
Metrics.getRegistry().register(getType() + ".auditReporter.queueSize", new Gauge<Integer>() {
@Override
public Integer getValue() {
return (int) disruptor.getRingBuffer().remainingCapacity();
}
});
}
示例2: calculateRingBufferSize
import com.lmax.disruptor.util.Util; //导入方法依赖的package包/类
private static int calculateRingBufferSize() {
int ringBufferSize = RINGBUFFER_DEFAULT_SIZE;
final String userPreferredRBSize = System.getProperty(
"AsyncLogger.RingBufferSize", String.valueOf(ringBufferSize));
try {
int size = Integer.parseInt(userPreferredRBSize);
if (size < RINGBUFFER_MIN_SIZE) {
size = RINGBUFFER_MIN_SIZE;
LOGGER.warn(
"Invalid RingBufferSize {}, using minimum size {}.",
userPreferredRBSize, RINGBUFFER_MIN_SIZE);
}
ringBufferSize = size;
} catch (final Exception ex) {
LOGGER.warn("Invalid RingBufferSize {}, using default size {}.",
userPreferredRBSize, ringBufferSize);
}
return Util.ceilingNextPowerOfTwo(ringBufferSize);
}
示例3: calculateRingBufferSize
import com.lmax.disruptor.util.Util; //导入方法依赖的package包/类
private static int calculateRingBufferSize() {
int ringBufferSize = RINGBUFFER_DEFAULT_SIZE;
final String userPreferredRBSize = System.getProperty(
"AsyncLoggerConfig.RingBufferSize",
String.valueOf(ringBufferSize));
try {
int size = Integer.parseInt(userPreferredRBSize);
if (size < RINGBUFFER_MIN_SIZE) {
size = RINGBUFFER_MIN_SIZE;
LOGGER.warn(
"Invalid RingBufferSize {}, using minimum size {}.",
userPreferredRBSize, RINGBUFFER_MIN_SIZE);
}
ringBufferSize = size;
} catch (final Exception ex) {
LOGGER.warn("Invalid RingBufferSize {}, using default size {}.",
userPreferredRBSize, ringBufferSize);
}
return Util.ceilingNextPowerOfTwo(ringBufferSize);
}