|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectkrati.core.array.basic.StaticShortArray
public class StaticShortArray
StaticShortArray: Fixed-Size Persistent ShortArray Implementation. This class is not thread-safe by design. It is expected that the conditions below hold within one JVM.
1. There is one and only one instance of StaticShortArray for a given home directory. 2. There is one and only one thread is calling the setData method at any given time.It is expected that this class is used in the case of multiple readers and single writer.
Field Summary | |
---|---|
protected ArrayFile |
_arrayFile
|
protected File |
_directory
|
protected EntryFactory<V> |
_entryFactory
|
protected ArrayEntryManager<V> |
_entryManager
|
protected int |
_length
|
Constructor Summary | |
---|---|
StaticShortArray(int length,
int entrySize,
int maxEntries,
File homeDirectory)
Create a fixed-length persistent short array. |
Method Summary | |
---|---|
void |
clear()
Clears this Array. |
short |
get(int index)
Gets data at a specified index. |
File |
getDirectory()
|
EntryFactory<V> |
getEntryFactory()
|
ArrayEntryManager<V> |
getEntryManager()
|
long |
getHWMark()
Gets the high water mark. |
short[] |
getInternalArray()
Gets the internal primitive array. |
long |
getLWMark()
Gets the low water mark. |
boolean |
hasIndex(int index)
|
protected void |
init()
Loads data from the array file. |
protected void |
initArrayFile()
|
int |
length()
|
protected void |
loadArrayFileData()
|
protected ArrayFile |
openArrayFile(File file,
int initialLength,
int elementSize)
|
void |
persist()
Persists this array. |
void |
saveHWMark(long endOfPeriod)
Sync-up the high water mark to a given value. |
void |
set(int index,
short value,
long scn)
Sets data at a specified index. |
void |
sync()
Sync array file with all entry logs. |
void |
updateArrayFile(List<Entry<V>> entryList)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface krati.array.Array |
---|
hasIndex, length |
Field Detail |
---|
protected int _length
protected File _directory
protected ArrayFile _arrayFile
protected EntryFactory<V extends EntryValue> _entryFactory
protected ArrayEntryManager<V extends EntryValue> _entryManager
Constructor Detail |
---|
public StaticShortArray(int length, int entrySize, int maxEntries, File homeDirectory) throws Exception
length
- the length of this arrayentrySize
- the size of redo entry (i.e., batch size)maxEntries
- the number of redo entries required for updating the underlying array filehomeDirectory
- the home directory of this array
Exception
- if this array cannot be created.Method Detail |
---|
protected void loadArrayFileData()
public void saveHWMark(long endOfPeriod)
saveHWMark
in interface Persistable
endOfPeriod
- public void clear()
Array
clear
in interface Array
public short get(int index)
ShortArray
get
in interface ShortArray
public void set(int index, short value, long scn) throws Exception
ShortArray
set
in interface ShortArray
Exception
public short[] getInternalArray()
ShortArray
getInternalArray
in interface ShortArray
protected void init() throws IOException
IOException
protected final ArrayFile openArrayFile(File file, int initialLength, int elementSize) throws IOException
IOException
protected void initArrayFile()
public File getDirectory()
getDirectory
in interface RecoverableArray<V extends EntryValue>
public EntryFactory<V> getEntryFactory()
getEntryFactory
in interface RecoverableArray<V extends EntryValue>
public ArrayEntryManager<V> getEntryManager()
public boolean hasIndex(int index)
hasIndex
in interface Array
public int length()
length
in interface Array
public void sync() throws IOException
sync
in interface Persistable
IOException
public void persist() throws IOException
persist
in interface Persistable
IOException
public long getHWMark()
Persistable
getHWMark
in interface Persistable
public long getLWMark()
Persistable
getLWMark
in interface Persistable
public void updateArrayFile(List<Entry<V>> entryList) throws IOException
updateArrayFile
in interface RecoverableArray<V extends EntryValue>
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |