Package fr.dyade.aaa.util
Class NTransaction.LogFile
- java.lang.Object
-
- java.io.OutputStream
-
- java.io.ByteArrayOutputStream
-
- fr.dyade.aaa.util.NTransaction.LogFile
-
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable
- Enclosing class:
- NTransaction
static final class NTransaction.LogFile extends ByteArrayOutputStream
-
-
Field Summary
Fields Modifier and Type Field Description (package private) intcommitCountNumber of commit operation since starting up.(package private) intcurrentCurrent file pointer in logprivate static byte[]emptyUTFString(package private) intgarbageCountNumber of garbage operation since starting up.(package private) longgarbageTimeCumulated time of garbage operations since starting up.(package private) longgarbageTimeOutMaximum delay between 2 garbages.(package private) longlastGarbageTimeDate of last garbage.private static StringLockPathnameCoherence lock filename(package private) Hashtable<Object,Operation>logLog of all operations already committed but not reported on disk.(package private) RandomAccessFilelogFilelog file(package private) intlogMemorySizeprivate Stringmodeprivate Repositoryrepository-
Fields inherited from class java.io.ByteArrayOutputStream
buf, count
-
-
Constructor Summary
Constructors Constructor Description LogFile(File dir, Repository repository, boolean syncOnWrite)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) voidcommit(Hashtable<Object,Operation> ctxlog)Reports all buffered operations in logs.private voidgarbage()Reports all logged operations on disk.(package private) intgetLogFileSize()Returns the size of disk log in bytes.(package private) voidstop()(package private) voidwriteInt(int v)(package private) voidwriteUTF(String str)-
Methods inherited from class java.io.ByteArrayOutputStream
close, reset, size, toByteArray, toString, toString, toString, toString, write, write, writeBytes, writeTo
-
Methods inherited from class java.io.OutputStream
flush, nullOutputStream, write
-
-
-
-
Field Detail
-
log
Hashtable<Object,Operation> log
Log of all operations already committed but not reported on disk.
-
logFile
RandomAccessFile logFile
log file
-
current
int current
Current file pointer in log
-
commitCount
int commitCount
Number of commit operation since starting up.
-
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.
-
garbageTimeOut
long garbageTimeOut
Maximum delay between 2 garbages.
-
LockPathname
private static final String LockPathname
Coherence lock filename- See Also:
- Constant Field Values
-
repository
private Repository repository
-
mode
private String mode
-
emptyUTFString
private static final byte[] emptyUTFString
-
logMemorySize
int logMemorySize
-
-
Constructor Detail
-
LogFile
LogFile(File dir, Repository repository, boolean syncOnWrite) throws IOException
- Throws:
IOException
-
-
Method Detail
-
getLogFileSize
int getLogFileSize()
Returns the size of disk log in bytes.- Returns:
- The size of disk log in bytes.
-
writeUTF
void writeUTF(String str)
-
writeInt
void writeInt(int v)
-
commit
void commit(Hashtable<Object,Operation> ctxlog) throws IOException
Reports all buffered operations in logs.- Parameters:
ctxlog- the local transaction log.- Throws:
IOException- an error occurs.
-
garbage
private final void garbage() throws IOExceptionReports all logged operations on disk.- Throws:
IOException- an error occurs.
-
stop
void stop()
-
-