1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.hadoop.hbase.util;
20
21 import org.apache.hadoop.hbase.HConstants;
22 import org.apache.hadoop.hbase.classification.InterfaceAudience;
23
24
25
26
27
28 @InterfaceAudience.Private
29 public class NonceKey {
30 private long group;
31 private long nonce;
32
33 public NonceKey(long group, long nonce) {
34 assert nonce != HConstants.NO_NONCE;
35 this.group = group;
36 this.nonce = nonce;
37 }
38
39 @Override
40 public boolean equals(Object obj) {
41 if (obj == null || !(obj instanceof NonceKey)) {
42 return false;
43 }
44 NonceKey nk = ((NonceKey)obj);
45 return this.nonce == nk.nonce && this.group == nk.group;
46 }
47
48 @Override
49 public int hashCode() {
50 return (int)((group >> 32) ^ group ^ (nonce >> 32) ^ nonce);
51 }
52
53 @Override
54 public String toString() {
55 return "[" + group + ":" + nonce + "]";
56 }
57
58 public long getNonceGroup() {
59 return group;
60 }
61
62 public long getNonce() {
63 return nonce;
64 }
65 }