Java CLibrary.trySkipCache方法代码示例(javaclibrary.tryskipcache代码示例汇总)

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


Java CLibrary.trySkipCache方法代码示例(javaclibrary.tryskipcache代码示例汇总)

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

示例1: close

import org.apache.cassandra.utils.CLibrary; //导入方法依赖的package包/类
@Override
public void close()
{
    if (buffer == null)
        return; // already closed

    syncInternal();

    buffer = null;

    if (skipIOCache && bytesSinceCacheFlush > 0)
        CLibrary.trySkipCache(fd, 0, 0);

    try
    {
        out.close();
    }
    catch (IOException e)
    {
        throw new FSWriteError(e, getPath());
    }

    FileUtils.closeQuietly(metadata);
    CLibrary.tryCloseFD(directoryFD);
} 
开发者ID:pgaref,项目名称:ACaZoo,代码行数:26,代码来源:SequentialWriter.java

示例2: write

import org.apache.cassandra.utils.CLibrary; //导入方法依赖的package包/类
@Override
void write(int startMarker, int nextMarker)
{
    // if there's room in the discard section to write an empty header,
    // zero out the next sync marker so replayer can cleanly exit
    if (nextMarker <= buffer.capacity() - SYNC_MARKER_SIZE)
    {
        buffer.putInt(nextMarker, 0);
        buffer.putInt(nextMarker + 4, 0);
    }

    // write previous sync marker to point to next sync marker
    // we don't chain the crcs here to ensure this method is idempotent if it fails
    writeSyncMarker(buffer, startMarker, startMarker, nextMarker);

    try {
        SyncUtil.force((MappedByteBuffer) buffer);
    }
    catch (Exception e) // MappedByteBuffer.force() does not declare IOException but can actually throw it
    {
        throw new FSWriteError(e, getPath());
    }
    CLibrary.trySkipCache(fd, startMarker, nextMarker, logFile.getAbsolutePath());
} 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:25,代码来源:MemoryMappedSegment.java

示例3: deallocate

import org.apache.cassandra.utils.CLibrary; //导入方法依赖的package包/类
public void deallocate()
{
    buffer = null; // makes sure we don't use this after it's ostensibly closed

    if (skipIOCache && bytesSinceCacheFlush > 0)
        CLibrary.trySkipCache(fd, 0, 0);

    try
    {
        super.close();
    }
    catch (IOException e)
    {
        throw new FSReadError(e, filePath);
    }
} 
开发者ID:dprguiuc,项目名称:Cassandra-Wasef,代码行数:17,代码来源:RandomAccessReader.java

示例4: close

import org.apache.cassandra.utils.CLibrary; //导入方法依赖的package包/类
@Override
public void close()
{
    if (buffer == null)
        return; // already closed

    syncInternal();

    buffer = null;

    if (skipIOCache && bytesSinceCacheFlush > 0)
        CLibrary.trySkipCache(fd, 0, 0);

    try
    {
        out.close();
    }
    catch (IOException e)
    {
        throw new FSWriteError(e, getPath());
    }

    CLibrary.tryCloseFD(directoryFD);
} 
开发者ID:dprguiuc,项目名称:Cassandra-Wasef,代码行数:25,代码来源:SequentialWriter.java

示例5: sync

import org.apache.cassandra.utils.CLibrary; //导入方法依赖的package包/类
/**
 * Flush (flush()) whatever writes are pending, and block until the data has been persistently committed (fsync()).
 */
public void sync() throws IOException
{
    if (syncNeeded)
    {
        flush();

        channel.force(true); // true, because file length counts as
                             // "meta-data"

        if (skipCache)
        {
            // clear entire file from page cache
            CLibrary.trySkipCache(this.fd, 0, 0);

            minBufferOffset = Long.MAX_VALUE;
            bytesSinceCacheFlush = 0;
        }

        syncNeeded = false;
    }
} 
开发者ID:devdattakulkarni,项目名称:Cassandra-KVPM,代码行数:25,代码来源:BufferedRandomAccessFile.java

示例6: tidy

import org.apache.cassandra.utils.CLibrary; //导入方法依赖的package包/类
public void tidy()
{
    lookup.remove(desc);
    if (readMeterSyncFuture != null)
        readMeterSyncFuture.cancel(true);
    if (isCompacted.get())
        SystemKeyspace.clearSSTableReadMeter(desc.ksname, desc.cfname, desc.generation);
    // don't ideally want to dropPageCache for the file until all instances have been released
    CLibrary.trySkipCache(desc.filenameFor(Component.DATA), 0, 0);
    CLibrary.trySkipCache(desc.filenameFor(Component.PRIMARY_INDEX), 0, 0);
} 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:12,代码来源:SSTableReader.java

示例7: flushInternal

import org.apache.cassandra.utils.CLibrary; //导入方法依赖的package包/类
protected void flushInternal()
{
    if (isDirty)
    {
        flushData();

        if (trickleFsync)
        {
            bytesSinceTrickleFsync += validBufferBytes;
            if (bytesSinceTrickleFsync >= trickleFsyncByteInterval)
            {
                syncDataOnlyInternal();
                bytesSinceTrickleFsync = 0;
            }
        }

        if (skipIOCache)
        {
            // we don't know when the data reaches disk since we aren't
            // calling flush
            // so we continue to clear pages we don't need from the first
            // offset we see
            // periodically we update this starting offset
            bytesSinceCacheFlush += validBufferBytes;

            if (bytesSinceCacheFlush >= RandomAccessReader.CACHE_FLUSH_INTERVAL_IN_BYTES)
            {
                CLibrary.trySkipCache(this.fd, ioCacheStartOffset, 0);
                ioCacheStartOffset = bufferOffset;
                bytesSinceCacheFlush = 0;
            }
        }

        // Remember that we wrote, so we don't write it again on next flush().
        resetBuffer();

        isDirty = false;
    }
} 
开发者ID:pgaref,项目名称:ACaZoo,代码行数:40,代码来源:SequentialWriter.java

示例8: computeNext

import org.apache.cassandra.utils.CLibrary; //导入方法依赖的package包/类
@SuppressWarnings("resource")
protected Page computeNext()
{
    CLibrary.trySkipCache(input.getChannel().getFileDescriptor(), 0, input.getFilePointer(), input.getPath());

    if (input.isEOF())
        return endOfData();

    return new Page(input.getFilePointer());
} 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:11,代码来源:HintsReader.java

示例9: maybeSkipCache

import org.apache.cassandra.utils.CLibrary; //导入方法依赖的package包/类
private void maybeSkipCache()
{
    long position = position();

    // don't skip page cache for tiny files, on the assumption that if they are tiny, the target node is probably
    // alive, and if so, the file will be closed and dispatched shortly (within a minute), and the file will be dropped.
    if (position >= DatabaseDescriptor.getTrickleFsyncIntervalInKb() * 1024L)
        CLibrary.trySkipCache(fd, 0, position - (position % PAGE_SIZE), file.getPath());
} 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:10,代码来源:HintsWriter.java

示例10: dropPageCache

import org.apache.cassandra.utils.CLibrary; //导入方法依赖的package包/类
private void dropPageCache(String filePath)
{
    RandomAccessFile file = null;

    try
    {
        file = new RandomAccessFile(filePath, "r");

        int fd = CLibrary.getfd(file.getFD());

        if (fd > 0)
        {
            if (logger.isDebugEnabled())
                logger.debug(String.format("Dropping page cache of file %s.", filePath));

            CLibrary.trySkipCache(fd, 0, 0);
        }
    }
    catch (IOException e)
    {
        // we don't care if cache cleanup fails
    }
    finally
    {
        FileUtils.closeQuietly(file);
    }
} 
开发者ID:daidong,项目名称:GraphTrek,代码行数:28,代码来源:SSTableReader.java

示例11: reBuffer

import org.apache.cassandra.utils.CLibrary; //导入方法依赖的package包/类
/**
 * Read data from file starting from current currentOffset to populate buffer.
 */
protected void reBuffer()
{
    resetBuffer();

    try
    {
        if (bufferOffset >= channel.size())
            return;

        channel.position(bufferOffset); // setting channel position

        int read = 0;

        while (read < buffer.length)
        {
            int n = super.read(buffer, read, buffer.length - read);
            if (n < 0)
                break;
            read += n;
        }

        validBufferBytes = read;
        bytesSinceCacheFlush += read;
    }
    catch (IOException e)
    {
        throw new FSReadError(e, filePath);
    }

    if (skipIOCache && bytesSinceCacheFlush >= CACHE_FLUSH_INTERVAL_IN_BYTES)
    {
        // with random I/O we can't control what we are skipping so
        // it will be more appropriate to just skip a whole file after
        // we reach threshold
        CLibrary.trySkipCache(this.fd, 0, 0);
        bytesSinceCacheFlush = 0;
    }
} 
开发者ID:dprguiuc,项目名称:Cassandra-Wasef,代码行数:42,代码来源:RandomAccessReader.java

示例12: flush

import org.apache.cassandra.utils.CLibrary; //导入方法依赖的package包/类
/**
 * If we are dirty, flush dirty contents to the operating system. Does not imply fsync().
 *
 * Currently, for implementation reasons, this also invalidates the buffer.
 */
public void flush() throws IOException
{
    if (isDirty)
    {
        if (channel.position() != bufferOffset)
            channel.position(bufferOffset);

        super.write(buffer, 0, validBufferBytes);

        if (skipCache)
        {

            // we don't know when the data reaches disk since we aren't
            // calling flush
            // so we continue to clear pages we don't need from the first
            // offset we see
            // periodically we update this starting offset
            bytesSinceCacheFlush += validBufferBytes;

            if (bufferOffset < minBufferOffset)
                minBufferOffset = bufferOffset;

            if (bytesSinceCacheFlush >= MAX_BYTES_IN_PAGE_CACHE)
            {
                CLibrary.trySkipCache(this.fd, (int) minBufferOffset, 0);
                minBufferOffset = bufferOffset;
                bytesSinceCacheFlush = 0;
            }

        }

        // Remember that we wrote, so we don't write it again on next flush().
        resetBuffer();

        isDirty = false;
    }
} 
开发者ID:devdattakulkarni,项目名称:Cassandra-KVPM,代码行数:43,代码来源:BufferedRandomAccessFile.java

示例13: reBuffer

import org.apache.cassandra.utils.CLibrary; //导入方法依赖的package包/类
private void reBuffer() throws IOException
{
    flush(); // synchronizing buffer and file on disk
    resetBuffer();
    if (bufferOffset >= channel.size())
        return;

    if (bufferOffset < minBufferOffset)
        minBufferOffset = bufferOffset;

    channel.position(bufferOffset); // setting channel position
    int read = 0;
    while (read < buffer.length)
    {
        int n = super.read(buffer, read, buffer.length - read);
        if (n < 0)
            break;
        read += n;
    }
    validBufferBytes = read;

    bytesSinceCacheFlush += read;
    if (skipCache && bytesSinceCacheFlush >= MAX_BYTES_IN_PAGE_CACHE)
    {
        CLibrary.trySkipCache(this.fd, (int) minBufferOffset, 0);
        bytesSinceCacheFlush = 0;
        minBufferOffset = Long.MAX_VALUE;
    }
} 
开发者ID:devdattakulkarni,项目名称:Cassandra-KVPM,代码行数:30,代码来源:BufferedRandomAccessFile.java

示例14: close

import org.apache.cassandra.utils.CLibrary; //导入方法依赖的package包/类
@Override
public void close() throws IOException
{
    sync();
    buffer = null;

    if (skipCache && bytesSinceCacheFlush > 0)
    {
        CLibrary.trySkipCache(this.fd, 0, 0);
    }

    super.close();
} 
开发者ID:devdattakulkarni,项目名称:Cassandra-KVPM,代码行数:14,代码来源:BufferedRandomAccessFile.java

示例15: dropPageCache

import org.apache.cassandra.utils.CLibrary; //导入方法依赖的package包/类
public void dropPageCache(long before)
{
    CLibrary.trySkipCache(path, 0, before);
} 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:5,代码来源:SegmentedFile.java

本文标签属性:

示例:示例图

代码:代码是什么

java:java游戏

CLibrary:clibrary官方网站

trySkipCache:trySkipCache

上一篇:导演为什么能自导自演?(自导自演的意思是什么)
下一篇:闹剧[nào jù]什么意思?近义词和反义词是什么?英文翻译是什么?(闹剧是什么意思)

为您推荐