voldemort.store.readonly.io
Class MemLock

java.lang.Object
  extended by voldemort.store.readonly.io.MemLock
All Implemented Interfaces:
java.io.Closeable

public class MemLock
extends java.lang.Object
implements java.io.Closeable


Constructor Summary
MemLock(java.io.File file, java.io.FileDescriptor descriptor, long offset, long length)
          Call mmap a file descriptor, then lock the pages with MAP_LOCKED.
 
Method Summary
 void close()
          Release this lock so that the memory can be returned to the OS if it wants to us it.
 java.io.FileDescriptor getDescriptor()
           
 java.io.File getFile()
           
 void setDescriptor(java.io.FileDescriptor descriptor)
           
 void setFile(java.io.File file)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MemLock

public MemLock(java.io.File file,
               java.io.FileDescriptor descriptor,
               long offset,
               long length)
        throws java.io.IOException
Call mmap a file descriptor, then lock the pages with MAP_LOCKED. This will then prevent the pages from being swapped out due to VFS cache pressure.

Parameters:
descriptor - The file we should mmap and MAP_LOCKED
offset -
length -
Throws:
java.io.IOException
See Also:
close()
Method Detail

close

public void close()
           throws java.io.IOException
Release this lock so that the memory can be returned to the OS if it wants to us it.

Specified by:
close in interface java.io.Closeable
Throws:
java.io.IOException

getFile

public java.io.File getFile()

setFile

public void setFile(java.io.File file)

getDescriptor

public java.io.FileDescriptor getDescriptor()

setDescriptor

public void setDescriptor(java.io.FileDescriptor descriptor)


Jay Kreps, Roshan Sumbaly, Alex Feinberg, Bhupesh Bansal, Lei Gao, Chinmay Soman, Vinoth Chandar, Zhongjie Wu