Mercurial > hg > blitz_stable
diff src/org/dancres/blitz/config/TimeBarrierPersistent.java @ 0:3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
author | Dan Creswell <dan.creswell@gmail.com> |
---|---|
date | Sat, 21 Mar 2009 11:00:06 +0000 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/org/dancres/blitz/config/TimeBarrierPersistent.java Sat Mar 21 11:00:06 2009 +0000 @@ -0,0 +1,47 @@ +package org.dancres.blitz.config; + +/** + <p>Configures Blitz to make operations durable after a certain period of + time such that if an operation was submitted more than that time period ago, + it is guarenteed to be durable.</p> + + <p>This kind of persistence provides the developer/administrator with the + ability to trade persistence guarentee for speed. Certain applications can + tolerate this sort of behaviour because they incorporate their own + consistency checks which allow them to recover a certain amount of recent + state that the space hadn't yet persisted.</p> + */ +public class TimeBarrierPersistent extends PersistentBase { + + private long theFlushTime; + + /** + @param shouldReset specifies whether to reset the ObjectOutputStream + used for logging. This is a performance vs memory tradeoff + + @param shouldClean specifies whether old log files and snapshots should + be cleaned up or left for archiving. + + @param aMaxLogsBeforeSync is the maximum number of log entries before + a checkpoint is forced. + + @param aLogBufferSize especially useful when doing flushing + All commands are rendered to the buffer before going to disk in one + large block. Without the buffer, each command will trickle to disk as a + small update which isn't good for throughput! + + @param aFlushTime the period in millis after which a logged command + should be made durable. + */ + public TimeBarrierPersistent(boolean shouldReset, boolean shouldClean, + int aMaxLogsBeforeSync, int aLogBufferSize, + long aFlushTime) { + + super(shouldReset, shouldClean, aLogBufferSize, aMaxLogsBeforeSync); + theFlushTime = aFlushTime; + } + + public long getFlushTime() { + return theFlushTime; + } +}