本文整理汇总了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;
}
示例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();
}
示例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();
}
}
示例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));
}
示例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();
}
示例6: getOutput
import org.apache.commons.lang3.mutable.MutableLong; //导入方法依赖的package包/类
@Override
public Long getOutput(MutableLong accumulatedValue)
{
return accumulatedValue.longValue();
}