fr.dyade.aaa.util
Class NGTransaction.LogManager

java.lang.Object
  extended by java.io.OutputStream
      extended by java.io.ByteArrayOutputStream
          extended by fr.dyade.aaa.util.NGTransaction.LogManager
All Implemented Interfaces:
java.io.Closeable, java.io.Flushable
Enclosing class:
NGTransaction

static final class NGTransaction.LogManager
extends java.io.ByteArrayOutputStream

This class manages the memory log of operations and the multiples log files.


Field Summary
(package private)  int commitCount
          Number of commit operation since starting up.
(package private)  int current
          Current file pointer in log
(package private)  java.io.File dir
           
private static byte[] emptyUTFString
           
(package private)  int garbageCount
          Number of garbage operation since starting up.
(package private)  long garbageTime
          Cumulated time of garbage operations since starting up.
(package private)  long lastGarbageTime
          Date of last garbage.
(package private)  int loadFromLog
          Number of load from a log file.
private  java.io.File lockFile
          Coherence lock file
private static java.lang.String LockPathname
          Coherence lock filename
(package private)  java.util.Hashtable<java.lang.Object,Operation> log
          Log of all operations already committed but not reported on disk.
(package private)  NGTransaction.LogFile[] logFile
          log file
(package private)  int logidx
           
private  Repository repository
           
 
Fields inherited from class java.io.ByteArrayOutputStream
buf, count
 
Constructor Summary
NGTransaction.LogManager(java.io.File dir, Repository repository)
           
 
Method Summary
(package private)  void commit(java.util.Hashtable<java.lang.Object,Operation> ctxlog)
          Reports all buffered operations in logs.
private  void garbage()
          Reports all logged operations on disk.
private  void garbage(NGTransaction.LogFile logf)
          Reports all 'live' operations of a particular log file in the repository, the log file is then cleaned and closed.
 byte[] getFromLog(Operation op)
           
 byte[] getFromLog(java.lang.String dirName, java.lang.String name)
           
 java.lang.String[] getList(java.lang.String prefix)
           
(package private)  int getLogFileSize()
          Returns the size of disk log in bytes.
 byte[] load(java.lang.String dirName, java.lang.String name)
           
(package private)  void stop()
           
(package private)  void writeInt(int v)
           
(package private)  void writeUTF(java.lang.String str)
           
 
Methods inherited from class java.io.ByteArrayOutputStream
close, reset, size, toByteArray, toString, toString, toString, write, write, writeTo
 
Methods inherited from class java.io.OutputStream
flush, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

log

java.util.Hashtable<java.lang.Object,Operation> log
Log of all operations already committed but not reported on disk.


logidx

int logidx

logFile

NGTransaction.LogFile[] logFile
log file


current

int current
Current file pointer in log


commitCount

int commitCount
Number of commit operation since starting up.


loadFromLog

int loadFromLog
Number of load from a log file.


garbageCount

int garbageCount
Number of garbage operation since starting up.


garbageTime

long garbageTime
Cumulated time of garbage operations since starting up.


lastGarbageTime

long lastGarbageTime
Date of last garbage.


LockPathname

private static final java.lang.String LockPathname
Coherence lock filename

See Also:
Constant Field Values

lockFile

private java.io.File lockFile
Coherence lock file


repository

private Repository repository

dir

java.io.File dir

emptyUTFString

private static final byte[] emptyUTFString
Constructor Detail

NGTransaction.LogManager

NGTransaction.LogManager(java.io.File dir,
                         Repository repository)
                   throws java.io.IOException
Throws:
java.io.IOException
Method Detail

getLogFileSize

int getLogFileSize()
Returns the size of disk log in bytes.

Returns:
The size of disk log in bytes.

commit

void commit(java.util.Hashtable<java.lang.Object,Operation> ctxlog)
      throws java.io.IOException
Reports all buffered operations in logs.

Throws:
java.io.IOException

getFromLog

public byte[] getFromLog(java.lang.String dirName,
                         java.lang.String name)
                  throws java.io.IOException
Throws:
java.io.IOException

getFromLog

public byte[] getFromLog(Operation op)
                  throws java.io.IOException
Throws:
java.io.IOException

load

public byte[] load(java.lang.String dirName,
                   java.lang.String name)
            throws java.io.IOException
Throws:
java.io.IOException

getList

public java.lang.String[] getList(java.lang.String prefix)

garbage

private final void garbage()
                    throws java.io.IOException
Reports all logged operations on disk.

Throws:
java.io.IOException

garbage

private final void garbage(NGTransaction.LogFile logf)
                    throws java.io.IOException
Reports all 'live' operations of a particular log file in the repository, the log file is then cleaned and closed.

Parameters:
logf - The log file to garbage.
Throws:
java.io.IOException

stop

void stop()

writeUTF

void writeUTF(java.lang.String str)

writeInt

void writeInt(int v)


Copyright © 2010 ScalAgent D.T.. All Rights Reserved.