• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java RefCountedMemory类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.cassandra.cache.RefCountedMemory的典型用法代码示例。如果您正苦于以下问题:Java RefCountedMemory类的具体用法?Java RefCountedMemory怎么用?Java RefCountedMemory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



RefCountedMemory类属于org.apache.cassandra.cache包,在下文中一共展示了RefCountedMemory类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: OffHeapBitSet

import org.apache.cassandra.cache.RefCountedMemory; //导入依赖的package包/类
public OffHeapBitSet(long numBits)
{
    // OpenBitSet.bits2words calculation is there for backward compatibility.
    long wordCount = OpenBitSet.bits2words(numBits);
    if (wordCount > Integer.MAX_VALUE)
        throw new UnsupportedOperationException("Bloom filter size is > 16GB, reduce the bloom_filter_fp_chance");
    try
    {
        long byteCount = wordCount * 8L;
        bytes = RefCountedMemory.allocate(byteCount);
    }
    catch (OutOfMemoryError e)
    {
        throw new RuntimeException("Out of native memory occured, You can avoid it by increasing the system ram space or by increasing bloom_filter_fp_chance.");
    }
    // flush/clear the existing memory.
    clear();
}
 
开发者ID:pgaref,项目名称:ACaZoo,代码行数:19,代码来源:OffHeapBitSet.java


示例2: deserialize

import org.apache.cassandra.cache.RefCountedMemory; //导入依赖的package包/类
public static OffHeapBitSet deserialize(DataInput in) throws IOException
{
    long byteCount = in.readInt() * 8L;
    Memory memory = RefCountedMemory.allocate(byteCount);
    for (long i = 0; i < byteCount;)
    {
        long v = in.readLong();
        memory.setByte(i++, (byte) (v >>> 0));
        memory.setByte(i++, (byte) (v >>> 8));
        memory.setByte(i++, (byte) (v >>> 16));
        memory.setByte(i++, (byte) (v >>> 24));
        memory.setByte(i++, (byte) (v >>> 32));
        memory.setByte(i++, (byte) (v >>> 40));
        memory.setByte(i++, (byte) (v >>> 48));
        memory.setByte(i++, (byte) (v >>> 56));
    }
    return new OffHeapBitSet(memory);
}
 
开发者ID:pgaref,项目名称:ACaZoo,代码行数:19,代码来源:OffHeapBitSet.java


示例3: deserialize

import org.apache.cassandra.cache.RefCountedMemory; //导入依赖的package包/类
public static OffHeapBitSet deserialize(DataInput dis) throws IOException
{
    long byteCount = dis.readInt() * 8L;
    Memory memory = RefCountedMemory.allocate(byteCount);
    for (long i = 0; i < byteCount;)
    {
        long v = dis.readLong();
        memory.setByte(i++, (byte) (v >>> 0));
        memory.setByte(i++, (byte) (v >>> 8));
        memory.setByte(i++, (byte) (v >>> 16));
        memory.setByte(i++, (byte) (v >>> 24));
        memory.setByte(i++, (byte) (v >>> 32));
        memory.setByte(i++, (byte) (v >>> 40));
        memory.setByte(i++, (byte) (v >>> 48));
        memory.setByte(i++, (byte) (v >>> 56));
    }
    return new OffHeapBitSet(memory);
}
 
开发者ID:dprguiuc,项目名称:Cassandra-Wasef,代码行数:19,代码来源:OffHeapBitSet.java


示例4: IndexSummary

import org.apache.cassandra.cache.RefCountedMemory; //导入依赖的package包/类
public IndexSummary(IPartitioner partitioner, RefCountedMemory memory, int summarySize, int sizeAtFullSampling,
                    int minIndexInterval, int samplingLevel)
{
    this.partitioner = partitioner;
    this.minIndexInterval = minIndexInterval;
    this.summarySize = summarySize;
    this.sizeAtFullSampling = sizeAtFullSampling;
    this.bytes = memory;
    this.samplingLevel = samplingLevel;
}
 
开发者ID:daidong,项目名称:GraphTrek,代码行数:11,代码来源:IndexSummary.java


示例5: deserialize

import org.apache.cassandra.cache.RefCountedMemory; //导入依赖的package包/类
public IndexSummary deserialize(DataInputStream in, IPartitioner partitioner, boolean haveSamplingLevel, int expectedMinIndexInterval, int maxIndexInterval) throws IOException
{
    int minIndexInterval = in.readInt();
    if (minIndexInterval != expectedMinIndexInterval)
    {
        throw new IOException(String.format("Cannot read index summary because min_index_interval changed from %d to %d.",
                                            minIndexInterval, expectedMinIndexInterval));
    }

    int summarySize = in.readInt();
    long offheapSize = in.readLong();
    int samplingLevel, fullSamplingSummarySize;
    if (haveSamplingLevel)
    {
        samplingLevel = in.readInt();
        fullSamplingSummarySize = in.readInt();
    }
    else
    {
        samplingLevel = BASE_SAMPLING_LEVEL;
        fullSamplingSummarySize = summarySize;
    }

    int effectiveIndexInterval = (int) Math.ceil((BASE_SAMPLING_LEVEL / (double) samplingLevel) * minIndexInterval);
    if (effectiveIndexInterval > maxIndexInterval)
    {
        throw new IOException(String.format("Rebuilding index summary because the effective index interval (%d) is higher than" +
                                            " the current max index interval (%d)", effectiveIndexInterval, maxIndexInterval));
    }

    RefCountedMemory memory = new RefCountedMemory(offheapSize);
    FBUtilities.copy(in, new MemoryOutputStream(memory), offheapSize);
    return new IndexSummary(partitioner, memory, summarySize, fullSamplingSummarySize, minIndexInterval, samplingLevel);
}
 
开发者ID:daidong,项目名称:GraphTrek,代码行数:35,代码来源:IndexSummary.java


示例6: CompressionMetadata

import org.apache.cassandra.cache.RefCountedMemory; //导入依赖的package包/类
private CompressionMetadata(String filePath, CompressionParameters parameters, RefCountedMemory offsets, long offsetsSize, long dataLength, long compressedLength, boolean hasPostCompressionAdlerChecksums)
{
    this.indexFilePath = filePath;
    this.parameters = parameters;
    this.dataLength = dataLength;
    this.compressedFileLength = compressedLength;
    this.hasPostCompressionAdlerChecksums = hasPostCompressionAdlerChecksums;
    this.chunkOffsets = offsets;
    offsets.reference();
    this.chunkOffsetsSize = offsetsSize;
}
 
开发者ID:daidong,项目名称:GraphTrek,代码行数:12,代码来源:CompressionMetadata.java


示例7: close

import org.apache.cassandra.cache.RefCountedMemory; //导入依赖的package包/类
public void close()
{
    if (chunkOffsets instanceof RefCountedMemory)
        ((RefCountedMemory) chunkOffsets).unreference();
    else
        chunkOffsets.free();
}
 
开发者ID:daidong,项目名称:GraphTrek,代码行数:8,代码来源:CompressionMetadata.java


示例8: addOffset

import org.apache.cassandra.cache.RefCountedMemory; //导入依赖的package包/类
public void addOffset(long offset)
{
    if (count == maxCount)
    {
        RefCountedMemory newOffsets = offsets.copy((maxCount *= 2) * 8);
        offsets.unreference();
        offsets = newOffsets;
    }
    offsets.setLong(8 * count++, offset);
}
 
开发者ID:daidong,项目名称:GraphTrek,代码行数:11,代码来源:CompressionMetadata.java


示例9: openAfterClose

import org.apache.cassandra.cache.RefCountedMemory; //导入依赖的package包/类
public CompressionMetadata openAfterClose(long dataLength, long compressedLength)
{
    RefCountedMemory newOffsets = offsets.copy(count * 8L);
    offsets.unreference();
    return new CompressionMetadata(filePath, parameters, newOffsets, count * 8L, dataLength, compressedLength, Descriptor.Version.CURRENT.hasPostCompressionAdlerChecksums);
}
 
开发者ID:daidong,项目名称:GraphTrek,代码行数:7,代码来源:CompressionMetadata.java


示例10: MemoryInputStream

import org.apache.cassandra.cache.RefCountedMemory; //导入依赖的package包/类
public MemoryInputStream(RefCountedMemory mem)
{
    this.mem = mem;
}
 
开发者ID:dprguiuc,项目名称:Cassandra-Wasef,代码行数:5,代码来源:MemoryInputStream.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java IJavaArray类代码示例发布时间:2022-05-23
下一篇:
Java Instance类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap