public class ControlledFileReader extends java.lang.Object implements ControlledReader<Tuple>
Constructor and Description |
---|
ControlledFileReader(ControlledFileReaderFlags meta,
java.lang.String filePath,
MessageType keyType,
MessageType dataType,
java.util.Comparator keyComparator) |
Modifier and Type | Method and Description |
---|---|
void |
clearRestorePoint() |
int |
compareTo(ControlledReader o) |
void |
createRestorePoint() |
boolean |
hasNext() |
boolean |
hasRestorePoint() |
Tuple |
next() |
java.lang.Object |
nextKey()
Get the next key
|
void |
open()
Open the reader
|
void |
releaseResources()
This method tries to do following things in order,
Try to unmamp, release memoery mapped buffer
Close file channels
Make this.buffer garbage collectible
|
void |
restore() |
public ControlledFileReader(ControlledFileReaderFlags meta, java.lang.String filePath, MessageType keyType, MessageType dataType, java.util.Comparator keyComparator)
public void open()
ControlledReader
open
in interface ControlledReader<Tuple>
public void releaseResources()
If unmapping fails, we expect GC to take care of releasing resources. But this could fail when we have a large heap space(mmap limit could hit before GC runs). For those cases, only option is to increase max_map_count of OS.
releaseResources
in interface ControlledReader<Tuple>
public boolean hasNext()
hasNext
in interface java.util.Iterator<Tuple>
public java.lang.Object nextKey()
ControlledReader
nextKey
in interface ControlledReader<Tuple>
public int compareTo(ControlledReader o)
compareTo
in interface java.lang.Comparable<ControlledReader<Tuple>>
public void createRestorePoint()
createRestorePoint
in interface Restorable
public void restore()
restore
in interface Restorable
public void clearRestorePoint()
clearRestorePoint
in interface Restorable
public boolean hasRestorePoint()
hasRestorePoint
in interface Restorable