KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tc > objectserver > tx > TestTransactionBatchManager


1 /*
2  * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
3  */

4 package com.tc.objectserver.tx;
5
6 import EDU.oswego.cs.dl.util.concurrent.LinkedQueue;
7 import EDU.oswego.cs.dl.util.concurrent.SynchronizedBoolean;
8
9 import com.tc.exception.TCRuntimeException;
10 import com.tc.net.protocol.tcm.ChannelID;
11 import com.tc.object.tx.TransactionID;
12 import com.tc.object.tx.TxnBatchID;
13 import com.tc.util.concurrent.NoExceptionLinkedQueue;
14
15 public final class TestTransactionBatchManager implements TransactionBatchManager {
16
17   public final LinkedQueue defineBatchContexts = new LinkedQueue();
18
19   public void defineBatch(ChannelID channelID, TxnBatchID batchID, int count) {
20     Object JavaDoc[] args = new Object JavaDoc[] { channelID, batchID, new Integer JavaDoc(count) };
21     try {
22       defineBatchContexts.put(args);
23     } catch (InterruptedException JavaDoc e) {
24       throw new TCRuntimeException(e);
25     }
26   }
27
28   public final NoExceptionLinkedQueue batchComponentCompleteCalls = new NoExceptionLinkedQueue();
29   public final SynchronizedBoolean isBatchComponentComplete = new SynchronizedBoolean(false);
30   
31   public boolean batchComponentComplete(ChannelID channelID, TxnBatchID batchID, TransactionID txnID) {
32     batchComponentCompleteCalls.put(new Object JavaDoc[] {channelID, batchID, txnID });
33     return isBatchComponentComplete.get();
34   }
35
36   public final NoExceptionLinkedQueue shutdownClientCalls = new NoExceptionLinkedQueue();
37   public void shutdownClient(ChannelID channelID) {
38     shutdownClientCalls.put(channelID);
39   }
40
41 }
Popular Tags