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


Java MutableLong.longValue方法代码示例

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


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

示例1: stampSequenceIdAndPublishToRingBuffer

import org.apache.commons.lang3.mutable.MutableLong; //导入方法依赖的package包/类
protected final long stampSequenceIdAndPublishToRingBuffer(RegionInfo hri, WALKeyImpl key,
    WALEdit edits, boolean inMemstore, RingBuffer<RingBufferTruck> ringBuffer)
    throws IOException {
  if (this.closed) {
    throw new IOException(
        "Cannot append; log is closed, regionName = " + hri.getRegionNameAsString());
  }
  MutableLong txidHolder = new MutableLong();
  MultiVersionConcurrencyControl.WriteEntry we = key.getMvcc().begin(() -> {
    txidHolder.setValue(ringBuffer.next());
  });
  long txid = txidHolder.longValue();
  try (TraceScope scope = TraceUtil.createTrace(implClassName + ".append")) {
    FSWALEntry entry = new FSWALEntry(txid, key, edits, hri, inMemstore);
    entry.stampRegionSequenceId(we);
    ringBuffer.get(txid).load(entry);
  } finally {
    ringBuffer.publish(txid);
  }
  return txid;
}
 
开发者ID:apache,项目名称:hbase,代码行数:22,代码来源:AbstractFSWAL.java

示例2: freeMemory

import org.apache.commons.lang3.mutable.MutableLong; //导入方法依赖的package包/类
@Override
public long freeMemory() {
    MutableLong totalBytesReleased = new MutableLong(0);
    ifNotClosed(() -> {
        for (FileBucket bucket : fileBuckets) {
            bucket.lockRead();
            for (FileInfo fileInfo : bucket.getFiles()) {
                long bytesReleased = fileInfo.discardFileContents();
                updateSizeOfCachedFileContents(-bytesReleased);
                totalBytesReleased.add(bytesReleased);
            }
            bucket.unlockRead();
        }
    });
    return totalBytesReleased.longValue();
}
 
开发者ID:koendeschacht,项目名称:count-db,代码行数:17,代码来源:FileDataInterface.java

示例3: getUniqueTimestamp

import org.apache.commons.lang3.mutable.MutableLong; //导入方法依赖的package包/类
private long getUniqueTimestamp(byte[] row) {
  int slot = Bytes.hashCode(row) & mask;
  MutableLong lastTimestamp = lastTimestamps[slot];
  long now = System.currentTimeMillis();
  synchronized (lastTimestamp) {
    long pt = lastTimestamp.longValue() >> 10;
    if (now > pt) {
      lastTimestamp.setValue(now << 10);
    } else {
      lastTimestamp.increment();
    }
    return lastTimestamp.longValue();
  }
}
 
开发者ID:apache,项目名称:hbase,代码行数:15,代码来源:WriteHeavyIncrementObserver.java

示例4: testSeparateWritingReading

import org.apache.commons.lang3.mutable.MutableLong; //导入方法依赖的package包/类
private void testSeparateWritingReading(DataType dataType, DataInterfaceFactory factory, DatabaseCachingType cachingType, int numberOfThreads, long numberOfItems) throws FileNotFoundException, InterruptedException {
    final BaseDataInterface dataInterface = createDataInterface(dataType, cachingType, factory);
    dataInterface.dropAllData();
    final DataInputStream inputStream = new DataInputStream(new BufferedInputStream(new FileInputStream(bigramFile)));

    //write data
    MutableLong numberOfItemsWritten = new MutableLong(0);
    CountDownLatch writeLatch = new CountDownLatch(numberOfThreads);
    long startOfWrite = System.nanoTime();
    for (int i = 0; i < numberOfThreads; i++) {
        new BigramTestsThread(dataType, numberOfItemsWritten, numberOfItems, inputStream, dataInterface, writeLatch, false).start();
    }
    writeLatch.await();
    dataInterface.flush();
    long endOfWrite = System.nanoTime();
    double writesPerSecond = numberOfItemsWritten.longValue() * 1e9 / (endOfWrite - startOfWrite);

    dataInterface.optimizeForReading();
    MutableLong numberOfItemsRead = new MutableLong(0);
    CountDownLatch readLatch = new CountDownLatch(numberOfThreads);
    long startOfRead = System.nanoTime();
    for (int i = 0; i < numberOfThreads; i++) {
        new BigramTestsThread(dataType, numberOfItemsRead, numberOfItems, inputStream, dataInterface, readLatch, true).start();
    }
    readLatch.await();
    dataInterface.flush();
    long endOfRead = System.nanoTime();
    double readsPerSecond = numberOfItemsRead.longValue() * 1e9 / (endOfRead - startOfRead);

    dataInterface.close();
    Log.i(factory.getClass().getSimpleName() + " threads " + numberOfThreads + " items " + numberOfItems + " write " + NumUtils.fmt(writesPerSecond) + " read " + NumUtils.fmt(readsPerSecond));
}
 
开发者ID:koendeschacht,项目名称:count-db,代码行数:33,代码来源:BigramTestsMain.java

示例5: testBatchWritingAndReading

import org.apache.commons.lang3.mutable.MutableLong; //导入方法依赖的package包/类
private void testBatchWritingAndReading(DataInterfaceFactory factory, DatabaseCachingType cachingType, int numberOfThreads, final long numberOfItems) throws FileNotFoundException, InterruptedException {
    final BaseDataInterface dataInterface = createDataInterface(cachingType, factory);
    dataInterface.dropAllData();

    MutableLong numberOfItemsWritten = new MutableLong(0);
    long startOfWrite = System.nanoTime();
    CountDownLatch countDownLatch = new CountDownLatch(numberOfThreads);
    for (int i = 0; i < numberOfThreads; i++) {
        new UniformDataTestsThread(numberOfItemsWritten, numberOfItems, dataInterface, countDownLatch, true).start();
    }
    countDownLatch.await();
    dataInterface.flush();
    long endOfWrite = System.nanoTime();
    double writesPerSecond = numberOfItemsWritten.longValue() * 1e9 / (endOfWrite - startOfWrite);

    countDownLatch = new CountDownLatch(numberOfThreads);
    dataInterface.optimizeForReading();
    MutableLong numberOfItemsRead = new MutableLong(0);
    long startOfRead = System.nanoTime();
    for (int i = 0; i < numberOfThreads; i++) {
        new UniformDataTestsThread(numberOfItemsRead, numberOfItems, dataInterface, countDownLatch, false).start();
    }
    countDownLatch.await();
    long endOfRead = System.nanoTime();
    double readsPerSecond = numberOfItemsRead.longValue() * 1e9 / (endOfRead - startOfRead);

    Log.i(factory.getClass().getSimpleName() + " threads " + numberOfThreads + " items " + numberOfItems + " write " + NumUtils.fmt(writesPerSecond) + " read " + NumUtils.fmt(readsPerSecond));
    dataInterface.close();
}
 
开发者ID:koendeschacht,项目名称:count-db,代码行数:30,代码来源:UniformDataTestsMain.java

示例6: getOutput

import org.apache.commons.lang3.mutable.MutableLong; //导入方法依赖的package包/类
@Override
public Long getOutput(MutableLong accumulatedValue)
{
  return accumulatedValue.longValue();
}
 
开发者ID:apache,项目名称:apex-malhar,代码行数:6,代码来源:SumLong.java


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