1 4 package com.tc.object.lockmanager.api; 5 6 import com.tc.net.protocol.tcm.ChannelID; 7 8 public class ServerThreadID { 9 public static final ServerThreadID NULL_ID = new ServerThreadID(ChannelID.NULL_ID, ThreadID.NULL_ID); 10 11 private final ChannelID channelID; 12 private final ThreadID threadID; 13 private final int hashCode; 14 15 public ServerThreadID(ChannelID channelID, ThreadID threadID) { 16 this.channelID = channelID; 17 this.threadID = threadID; 18 19 int hash = 31; 20 hash = (37 * hash) + channelID.hashCode(); 21 hash = (37 * hash) + threadID.hashCode(); 22 this.hashCode = hash; 23 } 24 25 public ChannelID getChannelID() { 26 return channelID; 27 } 28 29 public ThreadID getClientThreadID() { 30 return threadID; 31 } 32 33 public String toString() { 34 return new StringBuffer ().append("ServerThreadID{").append(channelID).append(',').append(threadID).append('}') 35 .toString(); 36 } 37 38 public int hashCode() { 39 return this.hashCode; 40 } 41 42 public boolean equals(Object obj) { 43 if (obj instanceof ServerThreadID) { 44 ServerThreadID other = (ServerThreadID) obj; 45 return this.channelID.equals(other.channelID) && this.threadID.equals(other.threadID); 46 } 47 return false; 48 } 49 } 50 | Popular Tags |