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


Java Util.ceilingNextPowerOfTwo方法代码示例

本文整理汇总了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();
    }
  });
}
 
开发者ID:uber,项目名称:chaperone,代码行数:27,代码来源:AuditReporter.java

示例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);
}
 
开发者ID:OuZhencong,项目名称:log4j2,代码行数:20,代码来源:AsyncLogger.java

示例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);
}
 
开发者ID:OuZhencong,项目名称:log4j2,代码行数:21,代码来源:AsyncLoggerConfigHelper.java


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