krati.core.array.basic
Class ArrayEntryManager<V extends EntryValue>

java.lang.Object
  extended by krati.core.array.basic.ArrayEntryManager<V>
All Implemented Interfaces:
Persistable

public class ArrayEntryManager<V extends EntryValue>
extends Object
implements Persistable


Constructor Summary
ArrayEntryManager(RecoverableArray<V> array, int maxEntries, int maxEntrySize)
           
 
Method Summary
protected  void applyEntries(boolean blocking)
          Apply accumulated entries to the array file.
protected  void applyEntries(List<Entry<V>> entries)
           
 void clear()
           
protected  void deleteEntryFiles()
          Delete entry log files on disk.
 boolean getAutoApplyEntries()
           
 File getDirectory()
           
 EntryFactory<V> getEntryFactory()
           
protected  String getEntryLogName(Entry<V> entry)
           
protected  String getEntryLogPrefix()
           
protected  String getEntryLogSuffix()
           
 EntryPersistListener getEntryPersistListener()
           
 long getHWMark()
          Gets the high water mark.
 long getLWMark()
          Gets the low water mark.
 int getMaxEntries()
           
 int getMaxEntrySize()
           
protected  void init(long arrayFileLwmScn, long arrayFileHwmScn)
           
protected  List<Entry<V>> loadEntryFiles()
          Load entry log files from disk into _entryList.
 void persist()
          Persist all updates from memory buffer into redo log files in non-blocking mode.
 void saveHWMark(long endOfPeriod)
          Save the high water mark.
 void setAutoApplyEntries(boolean b)
           
 void setEntryPersistListener(EntryPersistListener listener)
           
 void setWaterMarks(long lwmScn, long hwmScn)
           
protected  void switchEntry(boolean blocking)
          Switches to a new entry if _curEntry is not empty.
 void sync()
          Force all updates from memory buffer and redo log files to synchronize with the underlying persistent file in blocking mode.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ArrayEntryManager

public ArrayEntryManager(RecoverableArray<V> array,
                         int maxEntries,
                         int maxEntrySize)
Method Detail

getMaxEntries

public int getMaxEntries()

getMaxEntrySize

public int getMaxEntrySize()

getDirectory

public File getDirectory()

getEntryFactory

public EntryFactory<V> getEntryFactory()

getAutoApplyEntries

public boolean getAutoApplyEntries()

setAutoApplyEntries

public void setAutoApplyEntries(boolean b)

clear

public void clear()

getHWMark

public long getHWMark()
Description copied from interface: Persistable
Gets the high water mark.

Specified by:
getHWMark in interface Persistable

getLWMark

public long getLWMark()
Description copied from interface: Persistable
Gets the low water mark.

Specified by:
getLWMark in interface Persistable

saveHWMark

public void saveHWMark(long endOfPeriod)
                throws Exception
Description copied from interface: Persistable
Save the high water mark.

Specified by:
saveHWMark in interface Persistable
Throws:
Exception

setWaterMarks

public void setWaterMarks(long lwmScn,
                          long hwmScn)

sync

public void sync()
          throws IOException
Description copied from interface: Persistable
Force all updates from memory buffer and redo log files to synchronize with the underlying persistent file in blocking mode.

Specified by:
sync in interface Persistable
Throws:
IOException

persist

public void persist()
             throws IOException
Description copied from interface: Persistable
Persist all updates from memory buffer into redo log files in non-blocking mode.

Specified by:
persist in interface Persistable
Throws:
IOException

setEntryPersistListener

public void setEntryPersistListener(EntryPersistListener listener)

getEntryPersistListener

public EntryPersistListener getEntryPersistListener()

getEntryLogName

protected final String getEntryLogName(Entry<V> entry)
Returns:
the name of entry log file.

getEntryLogPrefix

protected final String getEntryLogPrefix()
Returns:
the prefix of entry log file.

getEntryLogSuffix

protected final String getEntryLogSuffix()
Returns:
the suffix of entry log file.

switchEntry

protected void switchEntry(boolean blocking)
                    throws IOException
Switches to a new entry if _curEntry is not empty.

Throws:
IOException

applyEntries

protected void applyEntries(boolean blocking)
                     throws IOException
Apply accumulated entries to the array file.

Throws:
IOException

loadEntryFiles

protected List<Entry<V>> loadEntryFiles()
Load entry log files from disk into _entryList.

Throws:
IOException

deleteEntryFiles

protected void deleteEntryFiles()
                         throws IOException
Delete entry log files on disk.

Throws:
IOException

applyEntries

protected void applyEntries(List<Entry<V>> entries)
                     throws IOException
Throws:
IOException

init

protected void init(long arrayFileLwmScn,
                    long arrayFileHwmScn)
             throws IOException
Throws:
IOException


Copyright © 2011. All Rights Reserved.