01: /*
02: * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
03: */
04: package com.tc.objectserver.tx;
05:
06: import com.tc.net.groups.NodeID;
07:
08: import java.util.HashSet;
09: 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 applyCommitted() {
29: state.applyCommitted();
30: }
31:
32: public void broadcastCompleted() {
33: state.broadcastCompleted();
34: }
35:
36: public boolean isComplete() {
37: return state.isComplete() && waitees.isEmpty();
38: }
39:
40: public String toString() {
41: return "TransactionRecord@" + System.identityHashCode(this )
42: + " = " + state + " :: waitees = " + waitees;
43: }
44:
45: public boolean addWaitee(NodeID waitee) {
46: return waitees.add(waitee);
47: }
48:
49: public boolean remove(NodeID waitee) {
50: return waitees.remove(waitee);
51: }
52:
53: public boolean isEmpty() {
54: return waitees.isEmpty();
55: }
56:
57: public boolean contains(NodeID waitee) {
58: return waitees.contains(waitee);
59: }
60: }
|