comparison src/org/dancres/blitz/txn/NullBatcher.java @ 17:4580bb12db30

Separate command execution from command logging.
author Dan Creswell <dan.creswell@gmail.com>
date Sun, 05 Jul 2009 16:26:25 +0100
parents
children
comparison
equal deleted inserted replaced
16:46ac1a45718a 17:4580bb12db30
1 package org.dancres.blitz.txn;
2
3 import java.io.IOException;
4 import java.io.Serializable;
5 import org.prevayler.Command;
6 import org.prevayler.PrevalentSystem;
7 import org.prevayler.implementation.SnapshotPrevayler;
8 import org.prevayler.implementation.PrevaylerCore;
9 import org.prevayler.implementation.Snapshotter;
10
11 public class NullBatcher implements SnapshotPrevayler {
12 private PrevaylerCore thePrevayler;
13
14 NullBatcher(PrevaylerCore aPrevayler) {
15 thePrevayler = aPrevayler;
16 }
17 public Snapshotter takeSnapshot() throws IOException {
18 return thePrevayler.takeSnapshot();
19 }
20
21 public PrevalentSystem system() {
22 return thePrevayler.system();
23 }
24
25 public Serializable executeCommand(Command aCommand) throws Exception {
26 thePrevayler.logCommand(aCommand);
27 return aCommand.execute(system());
28 }
29
30 public Serializable executeCommand(Command aCommand, boolean sync) throws Exception {
31 thePrevayler.logCommand(aCommand, sync);
32 return aCommand.execute(system());
33 }
34
35 }