1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.tikv.txn;
19
20 public class TxnExpireTime {
21
22 private boolean initialized = false;
23 private long txnExpire = 0;
24
25 public TxnExpireTime() {}
26
27 public TxnExpireTime(boolean initialized, long txnExpire) {
28 this.initialized = initialized;
29 this.txnExpire = txnExpire;
30 }
31
32 public void update(long lockExpire) {
33 if (lockExpire < 0) {
34 lockExpire = 0;
35 }
36
37 if (!this.initialized) {
38 this.txnExpire = lockExpire;
39 this.initialized = true;
40 return;
41 }
42
43 if (lockExpire < this.txnExpire) {
44 this.txnExpire = lockExpire;
45 }
46 }
47
48 public long value() {
49 if (!this.initialized) {
50 return 0L;
51 } else {
52 return this.txnExpire;
53 }
54 }
55 }