KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tc > objectserver > gtx > GlobalTransactionDescriptor


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.gtx;
5
6 import com.tc.net.protocol.tcm.ChannelID;
7 import com.tc.object.tx.ServerTransactionID;
8 import com.tc.object.tx.TransactionID;
9
10 import java.io.IOException JavaDoc;
11 import java.io.ObjectInputStream JavaDoc;
12 import java.io.Serializable JavaDoc;
13
14 // TODO:: Change name -- we dont even need this anymore
15
public class GlobalTransactionDescriptor implements Serializable JavaDoc {
16   private final ServerTransactionID stxn;
17
18   public GlobalTransactionDescriptor(ServerTransactionID serverTransactionID) {
19     this.stxn = serverTransactionID;
20   }
21
22   public String JavaDoc toString() {
23     return "GlobalTransactionDescriptor[" + stxn + "]";
24   }
25
26   public ChannelID getChannelID() {
27     return stxn.getChannelID();
28   }
29
30   public TransactionID getClientTransactionID() {
31     return stxn.getClientTransactionID();
32   }
33
34   private void writeObject(java.io.ObjectOutputStream JavaDoc out) throws IOException JavaDoc {
35     out.defaultWriteObject();
36   }
37
38   private void readObject(ObjectInputStream JavaDoc in) throws IOException JavaDoc, ClassNotFoundException JavaDoc {
39     in.defaultReadObject();
40   }
41
42   public int hashCode() {
43     return stxn.hashCode();
44   }
45
46   public boolean equals(Object JavaDoc o) {
47     if (o == null) return false;
48     if (!(o instanceof GlobalTransactionDescriptor)) return false;
49     if (o == this) return true;
50     GlobalTransactionDescriptor c = (GlobalTransactionDescriptor) o;
51     return this.stxn.equals(c.stxn);
52   }
53
54   public ServerTransactionID getServerTransactionID() {
55     return stxn;
56   }
57 }
58
Popular Tags