1 4 package com.tc.objectserver.tx; 5 6 import com.tc.net.protocol.tcm.ChannelID; 7 8 import java.util.HashSet ; 9 import java.util.Set ; 10 11 public class TransactionRecord { 12 private final TransactionState state; 13 private final Set waitees; 14 15 public TransactionRecord() { 16 this.state = new TransactionState(); 17 this.waitees = new HashSet (); 18 } 19 20 public void relayTransactionComplete() { 21 state.relayTransactionComplete(); 22 } 23 24 public void applyAndCommitSkipped() { 25 state.applyAndCommitSkipped(); 26 } 27 28 public void applyStarted() { 29 state.applyStarted(); 30 } 31 32 public void applyCommitted() { 33 state.applyCommitted(); 34 } 35 36 public void broadcastCompleted() { 37 state.broadcastCompleted(); 38 } 39 40 public boolean isComplete() { 41 return state.isComplete() && waitees.isEmpty(); 42 } 43 44 public String toString() { 45 return "TransactionRecord@" + System.identityHashCode(this) + " = " + state + " :: waitees = " + waitees; 46 } 47 48 public boolean addWaitee(ChannelID waitee) { 49 return waitees.add(waitee); 50 } 51 52 public boolean remove(ChannelID waitee) { 53 return waitees.remove(waitee); 54 } 55 56 public boolean isEmpty() { 57 return waitees.isEmpty(); 58 } 59 60 public boolean contains(ChannelID waitee) { 61 return waitees.contains(waitee); 62 } 63 } 64 | Popular Tags |