Mercurial > hg > blitz_stable
view src/org/dancres/blitz/txn/TimeBarrierPersonality.java @ 23:b7e52953b7a6
Add some cache/memory statistics to help spot potential exhaustion and other tuning issues.
author | Dan Creswell <dan.creswell@gmail.com> |
---|---|
date | Fri, 28 Aug 2009 17:23:33 +0100 |
parents | 4580bb12db30 |
children |
line wrap: on
line source
package org.dancres.blitz.txn; import java.util.logging.Level; import org.prevayler.implementation.SnapshotPrevayler; import org.prevayler.implementation.BufferingPrevaylerImpl; import org.prevayler.PrevalentSystem; import org.dancres.blitz.config.TimeBarrierPersistent; import org.dancres.blitz.disk.Disk; /** Understands how to translate TimeBarrierPersistent into core component configuration. @see org.dancres.blitz.config.TimeBarrierPersistent */ class TimeBarrierPersonality implements StoragePersonality { private TimeBarrierPersistent theModel; private String theLogDir; TimeBarrierPersonality(TimeBarrierPersistent aModel, String aLogDir) { theModel = aModel; theLogDir = aLogDir; TxnManager.theLogger.log(Level.INFO, "TimeBarrierPersonality"); TxnManager.theLogger.log(Level.INFO, "Max logs before sync: " + theModel.getMaxLogsBeforeSync()); TxnManager.theLogger.log(Level.INFO, "Reset log stream: " + theModel.shouldResetLogStream()); if (theModel.shouldCleanLogs()) { TxnManager.theLogger.log(Level.WARNING, "*** Automatically cleaning logs *** [EXPERIMENTAL]"); } Disk.init(); } public CheckpointTrigger getCheckpointTrigger(Checkpointer aCheckpointer) { /* return new OpCountingCheckpointTrigger(aCheckpointer, theModel.getMaxLogsBeforeSync()); */ return new TimeoutCheckpointTrigger(aCheckpointer, theModel.getMaxLogsBeforeSync(), theModel.getFlushTime()); } public SnapshotPrevayler getPrevayler(PrevalentSystem aSystem) throws Exception { PersistentReboot myReboot = new PersistentReboot(theModel); myReboot.execute(); SnapshotPrevayler myPrevayler = new BufferingPrevaylerImpl(aSystem, theLogDir, theModel.shouldResetLogStream(), theModel.shouldCleanLogs(), theModel.getLogBufferSize()); return myPrevayler; } public void destroy() { Disk.destroy(); Disk.clean(theLogDir); } }