java.util.concurrent.atomic.AtomicInteger.longValue()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(8.7k)|赞(0)|评价(0)|浏览(107)

本文整理了Java中java.util.concurrent.atomic.AtomicInteger.longValue()方法的一些代码示例,展示了AtomicInteger.longValue()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AtomicInteger.longValue()方法的具体详情如下:
包路径:java.util.concurrent.atomic.AtomicInteger
类名称:AtomicInteger
方法名:longValue

AtomicInteger.longValue介绍

[英]Returns the value of this AtomicInteger as a longafter a widening primitive conversion.
[中]将此AtomicInteger的值作为扩展原语转换后的long返回。

代码示例

代码示例来源:origin: org.mongodb/mongo-java-driver

/**
 * Returns the current number of registered sockets.
 *
 * @return number of sockets
 */
public long getCurrentRegistrationCount() {
  return currentRegistrations.longValue();
}

代码示例来源:origin: kairosdb/kairosdb

@Override
public List<DataPointSet> getMetrics(long now)
{
  List<DataPointSet> ret = new ArrayList<DataPointSet>();
  Map<String, AtomicInteger> counters = getAndClearCounters();
  for (String name : counters.keySet())
  {
    DataPointSet dps = new DataPointSet(METRIC_NAME);
    dps.addTag("metric_name", name);
    dps.addDataPoint(m_dataPointFactory.createDataPoint(now, counters.get(name).longValue()));
    ret.add(dps);
  }
  return (ret);
}

代码示例来源:origin: apache/incubator-gobblin

public TaskExecutionMetrics (TaskExecutor executor, MetricContext context) {
 taskExecutor = executor;
 contextAwareMetrics.add(context.newContextAwareGauge(CURRENT_QUEUED_TASK_COUNT, ()->this.taskExecutor.getCurrentQueuedTaskCount().longValue()));
 contextAwareMetrics.add(context.newContextAwareGauge(CURRENT_QUEUED_TASK_TOTAL_TIME, ()->this.taskExecutor.getCurrentQueuedTaskTotalTime().longValue()));
 contextAwareMetrics.add(context.newContextAwareGauge(HISTORICAL_QUEUED_TASK_COUNT, ()->this.taskExecutor.getHistoricalQueuedTaskCount().longValue()));
 contextAwareMetrics.add(context.newContextAwareGauge(HISTORICAL_QUEUED_TASK_TOTAL_TIME, ()->this.taskExecutor.getHistoricalQueuedTaskTotalTime().longValue()));
 contextAwareMetrics.add(context.newContextAwareGauge(QUEUED_TASK_COUNT, ()->this.taskExecutor.getQueuedTaskCount().longValue()));
 contextAwareMetrics.add(context.newContextAwareGauge(QUEUED_TASK_TOTAL_TIME, ()->this.taskExecutor.getQueuedTaskTotalTime().longValue()));
 contextAwareMetrics.add(context.newContextAwareGauge(FAILED_TASK_COUNT, ()->this.taskExecutor.getFailedTaskCount().getCount()));
 contextAwareMetrics.add(context.newContextAwareGauge(SUCCESSFUL_TASK_COUNT, ()->this.taskExecutor.getSuccessfulTaskCount().getCount()));
 contextAwareMetrics.add(context.newContextAwareGauge(RUNNING_TASK_COUNT, ()->this.taskExecutor.getRunningTaskCount().getCount()));
 this.rawMetrics.put(ConfigurationKeys.WORK_UNIT_CREATION_AND_RUN_INTERVAL, this.taskExecutor.getTaskCreateAndRunTimer());
}

代码示例来源:origin: pentaho/pentaho-kettle

result.setNrErrors( errors.longValue() );
result.setResult( errors.longValue() == 0 );
TransLogTable transLogTable = transMeta.getTransLogTable();

代码示例来源:origin: dadoonet/fscrawler

countTestHelper(new ESSearchRequest().withIndex(getCrawlerName()), numFiles.longValue(), null, TimeValue.timeValueMinutes(2));

代码示例来源:origin: org.mongodb/mongodb-driver-core

/**
 * Returns the current number of registered sockets.
 *
 * @return number of sockets
 */
public long getCurrentRegistrationCount() {
  return currentRegistrations.longValue();
}

代码示例来源:origin: com.marklogic/mlcp

public double computeProgress() {
  if (progress.length == 0) {
    return (double)1;
  }
  long result = 0;
  for (AtomicInteger pct : progress) {
    result += pct.longValue();
  }
  return (double)result / progress.length / 100;
}

代码示例来源:origin: io.sarl.lang/io.sarl.lang.core

/** The binary {@code modulo} operator. This is the equivalent to
 * the Java {@code %} operator. This function is not null-safe.
 *
 * @param left a number.
 * @param right a number.
 * @return {@code left%right}
 */
@Pure
@Inline(value = "($1.intValue() % $2.longValue())", constantExpression = true)
public static long operator_modulo(AtomicInteger left, AtomicLong right) {
  return left.longValue() % right.longValue();
}

代码示例来源:origin: io.sarl.lang/io.sarl.lang.core

/** The binary {@code minus} operator. This is the equivalent to
 * the Java {@code -} operator. This function is not null-safe.
 *
 * @param left a number.
 * @param right a number.
 * @return {@code left-right}
 */
@Pure
@Inline(value = "($1.intValue() - $2.longValue())", constantExpression = true)
public static long operator_minus(AtomicInteger left, Long right) {
  return left.longValue() - right.longValue();
}

代码示例来源:origin: io.sarl.lang/io.sarl.lang.core

/** The binary {@code divide} operator. This is the equivalent to
 * the Java {@code /} operator. This function is not null-safe.
 *
 * @param left a number.
 * @param right a number.
 * @return {@code left/right}
 */
@Pure
@Inline(value = "($1.intValue() / $2.longValue())", constantExpression = true)
public static long operator_divide(AtomicInteger left, Long right) {
  return left.longValue() / right.longValue();
}

代码示例来源:origin: io.sarl.lang/io.sarl.lang.core

/** The binary {@code multiply} operator. This is the equivalent to
 * the Java {@code *} operator. This function is not null-safe.
 *
 * @param left a number.
 * @param right a number.
 * @return {@code left*right}
 */
@Pure
@Inline(value = "($1.intValue() * $2.longValue())", constantExpression = true)
public static long operator_multiply(AtomicInteger left, Long right) {
  return left.longValue() * right.longValue();
}

代码示例来源:origin: io.sarl.lang/io.sarl.lang.core

/** The binary {@code greaterThan} operator. This is the equivalent
 * to the Java {@code &gt;} operator. This function is not null-safe.
 *
 * @param left a number.
 * @param right a number.
 * @return {@code left&gt;right}
 */
@Pure
@Inline(value = "($1.longValue() > $2)", constantExpression = true)
public static boolean operator_greaterThan(AtomicInteger left, long right) {
  return left.longValue() > right;
}

代码示例来源:origin: io.sarl.lang/io.sarl.lang.core

/** The binary {@code greaterEqualsThan} operator. This is the equivalent
 * to the Java {@code &gt;=} operator. This function is not null-safe.
 *
 * @param left a number.
 * @param right a number.
 * @return {@code left&gt;=right}
 */
@Pure
@Inline(value = "($1.longValue() >= $2)", constantExpression = true)
public static boolean operator_greaterEqualsThan(AtomicInteger left, long right) {
  return left.longValue() >= right;
}

代码示例来源:origin: io.sarl.lang/io.sarl.lang.core

/** The binary {@code lessThan} operator. This is the equivalent to
 * the Java {@code &lt;} operator. This function is not null-safe.
 *
 * @param left a number.
 * @param right a number.
 * @return {@code left&lt;right}
 */
@Pure
@Inline(value = "($1.longValue() < $2)", constantExpression = true)
public static boolean operator_lessThan(AtomicInteger left, long right) {
  return left.longValue() < right;
}

代码示例来源:origin: io.sarl.lang/io.sarl.lang.core

/** The binary {@code notEquals} operator. This is the equivalent
 * to the Java {@code !=} operator. This function is null-safe.
 *
 * @param left a number.
 * @param right a number.
 * @return {@code left!=right}
 */
@Pure
@Inline(value = "($1 == null ? false : ($1.longValue() != $2))", constantExpression = true)
public static boolean operator_notEquals(AtomicInteger left, long right) {
  return left == null ? false : left.longValue() != right;
}

代码示例来源:origin: io.sarl.lang/io.sarl.lang.core

/** The binary {@code minus} operator. This is the equivalent to
 * the Java {@code -} operator. This function is not null-safe.
 *
 * @param left a number.
 * @param right a number.
 * @return {@code left-right}
 */
@Pure
@Inline(value = "($1.intValue() - $2)", constantExpression = true)
public static long operator_minus(AtomicInteger left, long right) {
  return left.longValue() - right;
}

代码示例来源:origin: io.sarl.lang/io.sarl.lang.core

/** The binary {@code divide} operator. This is the equivalent to
 * the Java {@code /} operator. This function is not null-safe.
 *
 * @param left a number.
 * @param right a number.
 * @return {@code left/right}
 */
@Pure
@Inline(value = "($1.intValue() / $2)", constantExpression = true)
public static long operator_divide(AtomicInteger left, long right) {
  return left.longValue() / right;
}

代码示例来源:origin: synthetichealth/synthea

@Test
public void testGenerateOnlyDeadPatients() throws Exception {
 Config.set("generate.only_dead_patients", "true");
 int numberOfPeople = 2;
 Generator generator = new Generator(numberOfPeople);
 generator.run();
 assertEquals(0, generator.stats.get("alive").longValue());
 assertEquals(numberOfPeople, generator.stats.get("dead").longValue());
}

代码示例来源:origin: synthetichealth/synthea

@Test
public void testGenerateWithDatabase() throws Exception {
 int numberOfPeople = 1;
 Config.set("generate.database_type", "in-memory");
 Generator generator = new Generator(numberOfPeople, 0L);
 Config.set("generate.database_type", "none");
 assertNotNull(generator.database);
 generator.run();
 assertEquals(numberOfPeople, generator.stats.get("alive").longValue());
}

代码示例来源:origin: synthetichealth/synthea

@Test
public void testGenerateWithMetrics() throws Exception {
 int numberOfPeople = 1;
 Config.set("generate.track_detailed_transition_metrics", "true");
 Generator generator = new Generator(numberOfPeople, 0L);
 Config.set("generate.track_detailed_transition_metrics", "false");
 assertNotNull(generator.metrics);
 generator.run();
 assertEquals(numberOfPeople, generator.stats.get("alive").longValue());
}

相关文章