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  LogStream logstream_
           
protected  Hashtable logTable_
           
protected  boolean panic_
           
protected  long size_
           
 
Constructor Summary
StreamObjectLog(LogStream logstream, long checkpointInterval)
          Constructor.
 
Method Summary
 void close()
          Closes the log after use.
 void delete(Object id)
          Deletes the given object from the log.
 void flush(Recoverable rec)
          Flushes to permanent memory.
protected  void flush(com.atomikos.persistence.imp.SystemLogImage img, boolean shouldSync)
           
 void init()
          Initializes the object log.
 Vector recover()
          Recovers all non-deleted object images flushed so far.
 Recoverable recover(Object id)
          Recovers the instance with given 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_
Constructor Detail

StreamObjectLog

public StreamObjectLog(LogStream logstream,
                       long checkpointInterval)
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
Initializes 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
Recovers 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
Flushes 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
Description copied from interface: ObjectLog
Recovers the instance with given ID.

Specified by:
recover in interface ObjectLog
Parameters:
id - The id to recover. @return Recoverable The recovered logimage, null if not found. @exception LogException On failure.
Throws:
LogException
See Also:
ObjectLog

delete

public void delete(Object id)
            throws LogException
Description copied from interface: ObjectLog
Deletes 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 © 2012. All Rights Reserved.