public class BytableMemoryDiskList<T extends Bytable> extends Object implements AppendList<T>
Bytable data firstly into memory then into disk if over threshold.
Only two stages support in such kind of list. The first one is WRITE, the next is read. So far random WRITE and READ are not supported in this list.
WARNING: close() should be called at last to release file descriptor.
User should provide fileName in constructor and only one file is used to store data.
AppendList.State| Constructor and Description |
|---|
BytableMemoryDiskList(List<T> delegationList,
String className)
Constructor with only memory
delegationList. |
BytableMemoryDiskList(long maxSize,
BytableDiskList<T> bytableDiskList)
Constructor with memory bytes size limit and bytableDiskList setting.
|
BytableMemoryDiskList(long maxSize,
List<T> delegationList,
String className)
Constructor with max bytes size of memory and
delegationList. |
BytableMemoryDiskList(long maxSize,
List<T> delegationList,
String fileName,
String className)
Constructor with max bytes size of memory and
delegationList and disk file name in current working dir. |
BytableMemoryDiskList(long maxSize,
String className)
Constructor with only memory bytes size limit and className.
|
BytableMemoryDiskList(long maxSize,
String fileName,
String className)
Constructor with max bytes size of memory and disk file name in current working dir.
|
BytableMemoryDiskList(String className)
Default constructor.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
append(T t)
Append object to this list
|
void |
clear()
Clear all elements.
|
void |
close()
Close disk stream.
|
long |
getDiskCount() |
long |
getMemoryCount() |
Iterator<T> |
iterator() |
void |
reOpen()
Reopen stream for iteration.
|
int |
size()
Return size of this list.
|
void |
switchState()
After appending, switch state from WRITE to READ to allow iterating.
|
public BytableMemoryDiskList(long maxSize,
List<T> delegationList,
String className)
delegationList. Disk file name is random filename in
current working dir.public BytableMemoryDiskList(List<T> delegationList, String className)
delegationList. By default no limit of bytes size in memory.public BytableMemoryDiskList(long maxSize,
List<T> delegationList,
String fileName,
String className)
delegationList and disk file name in current working dir.public BytableMemoryDiskList(long maxSize,
String fileName,
String className)
LinkedList is used for memory list.public BytableMemoryDiskList(long maxSize,
BytableDiskList<T> bytableDiskList)
public BytableMemoryDiskList(long maxSize,
String className)
public BytableMemoryDiskList(String className)
LinkedList and random file name.public boolean append(T t)
AppendListappend in interface AppendList<T extends Bytable>t - the object to appendpublic void close()
BytableMemoryDiskList.public void reOpen()
public void switchState()
AppendListswitchState in interface AppendList<T extends Bytable>public int size()
AppendListsize in interface AppendList<T extends Bytable>public void clear()
AppendListclear in interface AppendList<T extends Bytable>public long getMemoryCount()
public long getDiskCount()
Copyright © 2015. All Rights Reserved.