|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectkrati.core.array.basic.StaticLongArray
public class StaticLongArray
StaticLongArray: Fixed-Size Persistent LongArray 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 StaticLongArray 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 | |
---|---|
StaticLongArray(int length,
int entrySize,
int maxEntries,
File homeDirectory)
Create a fixed-length persistent long array. |
Method Summary | |
---|---|
void |
clear()
Clears this Array. |
long |
get(int index)
Gets data at a specified index. |
File |
getDirectory()
|
EntryFactory<V> |
getEntryFactory()
|
ArrayEntryManager<V> |
getEntryManager()
|
long |
getHWMark()
Gets the high water mark. |
long[] |
getInternalArray()
Gets the internal primitive array. |
long |
getLWMark()
Gets the low water mark. |
EntryPersistListener |
getPersistListener()
Gets the listener that is called whenever an entry is persisted. |
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,
long value,
long scn)
Sets data at a specified index. |
void |
setCompactionAddress(int index,
long address,
long scn)
Sets the compaction address (produced by a compactor) at a specified index. |
void |
setPersistListener(EntryPersistListener persistListener)
Sets the listener that is called whenever an entry is persisted. |
void |
sync()
Sync array file with all entry logs. |
void |
updateArrayFile(List<Entry<V>> entryList)
|
void |
wrap(LongArray newArray)
|
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 |
Methods inherited from interface krati.Persistable |
---|
getHWMark, getLWMark, persist, sync |
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 StaticLongArray(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 long get(int index)
LongArray
get
in interface LongArray
public void set(int index, long value, long scn) throws Exception
LongArray
set
in interface LongArray
Exception
public void setCompactionAddress(int index, long address, long scn) throws Exception
AddressArray
setCompactionAddress
in interface AddressArray
index
- - the index to address arrayaddress
- - the address value for updatescn
- - the scn associated with this change
Exception
public long[] getInternalArray()
LongArray
getInternalArray
in interface LongArray
public void wrap(LongArray newArray) throws Exception
Exception
public EntryPersistListener getPersistListener()
AddressArray
getPersistListener
in interface AddressArray
public void setPersistListener(EntryPersistListener persistListener)
AddressArray
setPersistListener
in interface AddressArray
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 |