1 4 package com.tc.object.tx; 5 6 import java.io.Serializable ; 7 8 import com.tc.net.protocol.tcm.ChannelID; 9 import com.tc.object.tx.TransactionID; 10 11 15 public class ServerTransactionID implements Serializable { 16 public static final ServerTransactionID NULL_ID = new ServerTransactionID(ChannelID.NULL_ID, TransactionID.NULL_ID); 17 18 private final TransactionID txnID; 19 private final ChannelID channelID; 20 private final int hashCode; 21 22 public ServerTransactionID(ChannelID channelID, TransactionID txnID) { 23 this.channelID = channelID; 24 this.txnID = txnID; 25 26 int hash = 29; 27 hash = (37 * hash) + channelID.hashCode(); 28 hash = (37 * hash) + txnID.hashCode(); 29 this.hashCode = hash; 30 } 31 32 public ChannelID getChannelID() { 33 return channelID; 34 } 35 36 public TransactionID getClientTransactionID() { 37 return txnID; 38 } 39 40 public boolean isNull() { 41 return channelID.isNull() && txnID.isNull(); 42 } 43 44 public String toString() { 45 return new StringBuffer ().append("ServerTransactionID{").append(channelID).append(',').append(txnID).append('}') 46 .toString(); 47 } 48 49 public int hashCode() { 50 return this.hashCode; 51 } 52 53 public boolean equals(Object obj) { 54 if (obj instanceof ServerTransactionID) { 55 ServerTransactionID other = (ServerTransactionID) obj; 56 return this.channelID.equals(other.channelID) && this.txnID.equals(other.txnID); 57 } 58 return false; 59 } 60 } 61 | Popular Tags |