comparison src/org/dancres/blitz/txn/AbortCommand.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
comparison
equal deleted inserted replaced
-1:000000000000 0:3dc0c5604566
1 package org.dancres.blitz.txn;
2
3 import java.io.Serializable;
4
5 import java.util.logging.Level;
6
7 import net.jini.core.transaction.UnknownTransactionException;
8
9 import org.prevayler.Command;
10 import org.prevayler.PrevalentSystem;
11
12 /**
13 Command to issue abort against transaction held in TxnManagerState
14 */
15 class AbortCommand implements Command {
16 static final long serialVersionUID = 182858469530698187L;
17
18 private TxnId theId;
19
20 AbortCommand(TxnId anId) {
21 theId = anId;
22 }
23
24 public Serializable execute(PrevalentSystem aSystem) throws Exception {
25 TxnManagerState mySystem = (TxnManagerState) aSystem;
26
27 try {
28 mySystem.abort(theId);
29 } catch (UnknownTransactionException aUTE) {
30 /*
31 We may have logged the abort command whilst the transaction was
32 in active state which means there's no prior prepare command in
33 the log. If we then run recovery, the first time we'll do
34 anything with the transaction is when we load and execute abort.
35 Because there's no prior prepare, we will have no state loaded
36 for the transaction. Thus, if we can't find the transaction it's
37 okay but we shouldn't take further action.
38
39 Of course, we could be asked to abort something we're
40 unaware of which can happen under various circumstances
41 (including a buggy TxnMgr) but it's okay to swallow that silently.
42 */
43 TxnManager.theLogger.log(Level.FINE,
44 "Abort failed - transaction is missing",
45 aUTE);
46 }
47
48 return null;
49 }
50
51 public String toString() {
52 return " AB : " + theId;
53 }
54 }