01: /*
02: * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright
03: * notice. All rights reserved.
04: */
05: package com.tc.objectserver.tx;
06:
07: import EDU.oswego.cs.dl.util.concurrent.LinkedQueue;
08: import EDU.oswego.cs.dl.util.concurrent.SynchronizedBoolean;
09:
10: import com.tc.exception.TCRuntimeException;
11: import com.tc.net.groups.NodeID;
12: import com.tc.object.tx.TransactionID;
13: import com.tc.util.concurrent.NoExceptionLinkedQueue;
14:
15: public final class TestTransactionBatchManager implements
16: TransactionBatchManager {
17:
18: public final LinkedQueue defineBatchContexts = new LinkedQueue();
19:
20: public void defineBatch(NodeID node, int numTxns) {
21: Object[] args = new Object[] { node, new Integer(numTxns) };
22: try {
23: defineBatchContexts.put(args);
24: } catch (InterruptedException e) {
25: throw new TCRuntimeException(e);
26: }
27: }
28:
29: public final NoExceptionLinkedQueue batchComponentCompleteCalls = new NoExceptionLinkedQueue();
30: public final SynchronizedBoolean isBatchComponentComplete = new SynchronizedBoolean(
31: false);
32:
33: public boolean batchComponentComplete(NodeID committerID,
34: TransactionID txnID) {
35: batchComponentCompleteCalls.put(new Object[] { committerID,
36: txnID });
37: return isBatchComponentComplete.get();
38: }
39:
40: public final NoExceptionLinkedQueue shutdownClientCalls = new NoExceptionLinkedQueue();
41:
42: public void shutdownNode(NodeID nodeID) {
43: shutdownClientCalls.put(nodeID);
44: }
45:
46: }
|