com.atomikos.persistence.imp
Class FileLogStream

java.lang.Object
  extended by com.atomikos.persistence.imp.FileLogStream
All Implemented Interfaces:
LogStream

public class FileLogStream
extends Object
implements LogStream

A file implementation of a LogStream.


Constructor Summary
FileLogStream(String baseDir, String baseName, Console console)
           
 
Method Summary
 void close()
          For proper termination: a close method.
 void finalize()
           
 void flushObject(Object o, boolean shouldSync)
          Flush (force) an object to the stream.
 long getSize()
          Get the size of the stream.
 Vector recover()
          Reads the log contents, and initializes the data structure.
 void writeCheckpoint(Enumeration elements)
          After intial recovery, it is good practice to write a checkpoint with only the most recent data.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileLogStream

public FileLogStream(String baseDir,
                     String baseName,
                     Console console)
              throws IOException
Throws:
IOException
Method Detail

recover

public Vector recover()
               throws LogException
Description copied from interface: LogStream
Reads the log contents, and initializes the data structure. Should be called first.

Specified by:
recover in interface LogStream
Returns:
Vector The read objects from the log.
Throws:
LogException - On failure.

writeCheckpoint

public void writeCheckpoint(Enumeration elements)
                     throws LogException
Description copied from interface: LogStream
After intial recovery, it is good practice to write a checkpoint with only the most recent data. This method does that, and can also be called at random intervals during normal operation.

Specified by:
writeCheckpoint in interface LogStream
Parameters:
elements - The elements to keep in the log.
Throws:
LogException - On failure.

flushObject

public void flushObject(Object o,
                        boolean shouldSync)
                 throws LogException
Description copied from interface: LogStream
Flush (force) an object to the stream. If this method returns then the object is guaranteed to be persisted.

Specified by:
flushObject in interface LogStream
Throws:
LogException - On failure.

close

public void close()
           throws LogException
Description copied from interface: LogStream
For proper termination: a close method.

Specified by:
close in interface LogStream
Throws:
LogException - On failure.

finalize

public void finalize()
              throws Throwable
Overrides:
finalize in class Object
Throws:
Throwable

getSize

public long getSize()
             throws LogException
Description copied from interface: LogStream
Get the size of the stream.

Specified by:
getSize in interface LogStream
Returns:
long The size of the stream.
Throws:
LogException - On error.


Copyright © 2011. All Rights Reserved.