com.atomikos.persistence.imp
Class StreamObjectLog

java.lang.Object
  extended by com.atomikos.persistence.imp.StreamObjectLog
All Implemented Interfaces:
ObjectLog

public class StreamObjectLog
extends Object
implements ObjectLog

implementation. It keeps on growing, and only does a checkpoint on restart.


Field Summary
protected  Console console_
           
protected  LogStream logstream_
           
protected  Hashtable logTable_
           
protected  boolean panic_
           
protected  long size_
           
 
Constructor Summary
StreamObjectLog(LogStream logstream, long checkpointInterval, Console console)
          Constructor.
 
Method Summary
 void close()
          Closes the log after use.
 void delete(Object id)
          Delete the given object from the log.
 void flush(Recoverable rec)
          Flush to permanent memory.
protected  void flush(com.atomikos.persistence.imp.SystemLogImage img, boolean shouldSync)
           
 void init()
          Initialize the object log.
 Vector recover()
          Recover all non-deleted object images flushed so far.
 Recoverable recover(Object id)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logstream_

protected LogStream logstream_

logTable_

protected Hashtable logTable_

size_

protected long size_

panic_

protected boolean panic_

console_

protected Console console_
Constructor Detail

StreamObjectLog

public StreamObjectLog(LogStream logstream,
                       long checkpointInterval,
                       Console console)
Constructor. Builds a new StreamObjectLog with the given logstream and the specified maximum number of entries.

Parameters:
logstream - The underlying logstream. This stream should be reserved for this instance! Upon close, the underlying stream will also be closed.
checkpointInterval - How many flush() calls between two checkpoints?
console - For output of feedback.
Method Detail

init

public void init()
          throws LogException
Description copied from interface: ObjectLog
Initialize the object log. To be called as the first method.

Specified by:
init in interface ObjectLog
Throws:
LogException - If error occurs.
See Also:
ObjectLog

recover

public Vector recover()
               throws LogException
Description copied from interface: ObjectLog
Recover all non-deleted object images flushed so far.

Specified by:
recover in interface ObjectLog
Returns:
Vector A list of Recoverable instances, reconstructed from their images.
Throws:
LogException
See Also:
ObjectLog

flush

public void flush(Recoverable rec)
           throws LogException
Description copied from interface: ObjectLog
Flush to permanent memory.

Specified by:
flush in interface ObjectLog
Parameters:
rec - Recoverable instance. NOTE: if the instance has the same ObjectId as a previous one, then the latter will be overridden by this one! More precisely, history() will only return the last image for a given ObjectId.
Throws:
LogException - if it did not work.
See Also:
ObjectLog

flush

protected void flush(com.atomikos.persistence.imp.SystemLogImage img,
                     boolean shouldSync)
              throws LogException
Throws:
LogException

recover

public Recoverable recover(Object id)
                    throws LogException
Specified by:
recover in interface ObjectLog
Throws:
LogException
See Also:
ObjectLog

delete

public void delete(Object id)
            throws LogException
Description copied from interface: ObjectLog
Delete the given object from the log.

Specified by:
delete in interface ObjectLog
Parameters:
id - The object UID.
Throws:
LogException - on failure.
See Also:
ObjectLog

close

public void close()
           throws LogException
Description copied from interface: ObjectLog
Closes the log after use.

Specified by:
close in interface ObjectLog
Throws:
LogException - on failure.
See Also:
ObjectLog


Copyright © 2011. All Rights Reserved.