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


Java FileUtils.isCleanerAvailable方法代码示例

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


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

示例1: getMemtableAllocatorPool

import org.apache.cassandra.io.util.FileUtils; //导入方法依赖的package包/类
public static MemtablePool getMemtableAllocatorPool()
{
    long heapLimit = ((long) conf.memtable_heap_space_in_mb) << 20;
    long offHeapLimit = ((long) conf.memtable_offheap_space_in_mb) << 20;
    switch (conf.memtable_allocation_type)
    {
        case unslabbed_heap_buffers:
            return new HeapPool(heapLimit, conf.memtable_cleanup_threshold, new ColumnFamilyStore.FlushLargestColumnFamily());
        case heap_buffers:
            return new SlabPool(heapLimit, 0, conf.memtable_cleanup_threshold, new ColumnFamilyStore.FlushLargestColumnFamily());
        case offheap_buffers:
            if (!FileUtils.isCleanerAvailable())
            {
                logger.error("Could not free direct byte buffer: offheap_buffers is not a safe memtable_allocation_type without this ability, please adjust your config. This feature is only guaranteed to work on an Oracle JVM. Refusing to start.");
                System.exit(-1);
            }
            return new SlabPool(heapLimit, offHeapLimit, conf.memtable_cleanup_threshold, new ColumnFamilyStore.FlushLargestColumnFamily());
        case offheap_objects:
            return new NativePool(heapLimit, offHeapLimit, conf.memtable_cleanup_threshold, new ColumnFamilyStore.FlushLargestColumnFamily());
        default:
            throw new AssertionError();
    }
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:24,代码来源:DatabaseDescriptor.java

示例2: getDirectoryForNewSSTables

import org.apache.cassandra.io.util.FileUtils; //导入方法依赖的package包/类
public File getDirectoryForNewSSTables()
{
    File path = getWriteableLocationAsFile();

    // Requesting GC has a chance to free space only if we're using mmap and a non SUN jvm
    if (path == null
        && (DatabaseDescriptor.getDiskAccessMode() == Config.DiskAccessMode.mmap || DatabaseDescriptor.getIndexAccessMode() == Config.DiskAccessMode.mmap)
        && !FileUtils.isCleanerAvailable())
    {
        logger.info("Forcing GC to free up disk space.  Upgrade to the Oracle JVM to avoid this");
        StorageService.instance.requestGC();
        // retry after GCing has forced unmap of compacted SSTables so they can be deleted
        // Note: GCInspector will do this already, but only sun JVM supports GCInspector so far
        SSTableDeletingTask.rescheduleFailedTasks();
        Uninterruptibles.sleepUninterruptibly(10, TimeUnit.SECONDS);
        path = getWriteableLocationAsFile();
    }

    return path;
}
 
开发者ID:pgaref,项目名称:ACaZoo,代码行数:21,代码来源:Directories.java

示例3: close

import org.apache.cassandra.io.util.FileUtils; //导入方法依赖的package包/类
@Override
public void close()
{
    if (!FileUtils.isCleanerAvailable())
        return;

    /*
     * Try forcing the unmapping of pages using undocumented unsafe sun APIs.
     * If this fails (non Sun JVM), we'll have to wait for the GC to finalize the mapping.
     * If this works and a thread tries to access any page, hell will unleash on earth.
     */
    try
    {
        for (MappedByteBuffer segment : pages)
            FileUtils.clean(segment);
    }
    catch (Exception e)
    {
        // This is not supposed to happen
    }
}
 
开发者ID:xedin,项目名称:sasi,代码行数:22,代码来源:MappedBuffer.java

示例4: getMemtableAllocatorPool

import org.apache.cassandra.io.util.FileUtils; //导入方法依赖的package包/类
public static MemtablePool getMemtableAllocatorPool()
{
    long heapLimit = ((long) conf.memtable_heap_space_in_mb) << 20;
    long offHeapLimit = ((long) conf.memtable_offheap_space_in_mb) << 20;
    switch (conf.memtable_allocation_type)
    {
        case unslabbed_heap_buffers:
            return new HeapPool(heapLimit, conf.memtable_cleanup_threshold, new ColumnFamilyStore.FlushLargestColumnFamily());
        case heap_buffers:
            return new SlabPool(heapLimit, 0, conf.memtable_cleanup_threshold, new ColumnFamilyStore.FlushLargestColumnFamily());
        case offheap_buffers:
            if (!FileUtils.isCleanerAvailable())
            {
                throw new IllegalStateException("Could not free direct byte buffer: offheap_buffers is not a safe memtable_allocation_type without this ability, please adjust your config. This feature is only guaranteed to work on an Oracle JVM. Refusing to start.");
            }
            return new SlabPool(heapLimit, offHeapLimit, conf.memtable_cleanup_threshold, new ColumnFamilyStore.FlushLargestColumnFamily());
        case offheap_objects:
            throw new ConfigurationException("offheap_objects are not available in 3.0. They should be re-introduced in a future release, see https://issues.apache.org/jira/browse/CASSANDRA-9472 for details");
            // return new NativePool(heapLimit, offHeapLimit, conf.memtable_cleanup_threshold, new ColumnFamilyStore.FlushLargestColumnFamily());
        default:
            throw new AssertionError();
    }
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:24,代码来源:DatabaseDescriptor.java

示例5: internalClose

import org.apache.cassandra.io.util.FileUtils; //导入方法依赖的package包/类
void internalClose()
{
    try
    {
        if (FileUtils.isCleanerAvailable())
            FileUtils.clean(buffer);
        logFileAccessor.close();
    }
    catch (IOException e)
    {
        throw new FSWriteError(e, getPath());
    }
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:14,代码来源:CommitLogSegment.java

示例6: internalClose

import org.apache.cassandra.io.util.FileUtils; //导入方法依赖的package包/类
@Override
protected void internalClose()
{
    if (FileUtils.isCleanerAvailable())
        FileUtils.clean(buffer);
    super.internalClose();
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:8,代码来源:MemoryMappedSegment.java


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