KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tc > l2 > objectserver > ServerTransactionFactory


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

5 package com.tc.l2.objectserver;
6
7 import com.tc.l2.msg.ObjectSyncMessage;
8 import com.tc.object.tx.TransactionID;
9 import com.tc.objectserver.tx.ServerTransaction;
10
11 public class ServerTransactionFactory {
12
13   private static long tid = 1;
14
15   public static ServerTransaction createTxnFrom(ObjectSyncMessage syncMsg) {
16     ObjectSyncServerTransaction txn = new ObjectSyncServerTransaction(getNextTransactionID(), syncMsg.getOids(),
17                                                                       syncMsg.getDnaCount(), syncMsg.getSerializer(),
18                                                                       syncMsg.getDNAs(), syncMsg.getRootsMap());
19     return txn;
20   }
21
22   private static synchronized TransactionID getNextTransactionID() {
23     return new TransactionID(tid++);
24   }
25
26 }
27
Popular Tags