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.object.tx;
05:
06: import com.tc.object.dna.api.DNAEncoding;
07: import com.tc.object.dna.impl.ObjectStringSerializer;
08: import com.tc.object.msg.CommitTransactionMessageFactory;
09:
10: public class TransactionBatchWriterFactory implements
11: TransactionBatchFactory {
12:
13: private long batchIDSequence = 0;
14: private final CommitTransactionMessageFactory messageFactory;
15: private final DNAEncoding encoding;
16:
17: public TransactionBatchWriterFactory(
18: CommitTransactionMessageFactory messageFactory,
19: DNAEncoding encoding) {
20: this .messageFactory = messageFactory;
21: this .encoding = encoding;
22: }
23:
24: public synchronized ClientTransactionBatch nextBatch() {
25: return new TransactionBatchWriter(new TxnBatchID(
26: ++batchIDSequence), new ObjectStringSerializer(),
27: encoding, messageFactory);
28: }
29:
30: }
|