1 17 18 package org.apache.geronimo.transaction.manager; 19 20 import java.util.ArrayList ; 21 import java.util.Collection ; 22 import java.util.HashMap ; 23 import java.util.List ; 24 import java.util.Map ; 25 26 import javax.transaction.xa.Xid ; 27 28 34 public class MockLog implements TransactionLog { 35 36 final Map prepared = new HashMap (); 37 final List committed = new ArrayList (); 38 final List rolledBack = new ArrayList (); 39 40 public void begin(Xid xid) throws LogException { 41 } 42 43 public Object prepare(Xid xid, List branches) throws LogException { 44 Object mark = new Object (); 45 Recovery.XidBranchesPair xidBranchesPair = new Recovery.XidBranchesPair(xid, mark); 46 xidBranchesPair.getBranches().addAll(branches); 47 prepared.put(xid, xidBranchesPair); 48 return mark; 49 } 50 51 public void commit(Xid xid, Object logMark) throws LogException { 52 committed.add(xid); 53 } 54 55 public void rollback(Xid xid, Object logMark) throws LogException { 56 rolledBack.add(xid); 57 } 58 59 public Collection recover(XidFactory xidFactory) throws LogException { 60 Map copy = new HashMap (prepared); 61 copy.keySet().removeAll(committed); 62 copy.keySet().removeAll(rolledBack); 63 return copy.values(); 64 } 65 66 public String getXMLStats() { 67 return null; 68 } 69 70 public int getAverageForceTime() { 71 return 0; 72 } 73 74 public int getAverageBytesPerForce() { 75 return 0; 76 } 77 } 78 | Popular Tags |