|
25 | 25 | import org.apache.doris.common.FeConstants; |
26 | 26 | import org.apache.doris.common.Pair; |
27 | 27 | import org.apache.doris.common.UserException; |
28 | | -import org.apache.doris.common.lock.MonitoredReentrantReadWriteLock; |
29 | 28 | import org.apache.doris.resource.Tag; |
30 | 29 | import org.apache.doris.system.Backend; |
31 | 30 | import org.apache.doris.system.SystemInfoService; |
@@ -123,7 +122,7 @@ public TabletHealth() { |
123 | 122 | private long cooldownReplicaId = -1; |
124 | 123 | @SerializedName(value = "ctm", alternate = {"cooldownTerm"}) |
125 | 124 | private long cooldownTerm = -1; |
126 | | - private MonitoredReentrantReadWriteLock cooldownConfLock = new MonitoredReentrantReadWriteLock(); |
| 125 | + private final Object cooldownConfLock = new Object(); |
127 | 126 |
|
128 | 127 | // last time that the tablet checker checks this tablet. |
129 | 128 | // no need to persist |
@@ -184,22 +183,19 @@ public boolean isConsistent() { |
184 | 183 | } |
185 | 184 |
|
186 | 185 | public void setCooldownConf(long cooldownReplicaId, long cooldownTerm) { |
187 | | - cooldownConfLock.writeLock().lock(); |
188 | | - this.cooldownReplicaId = cooldownReplicaId; |
189 | | - this.cooldownTerm = cooldownTerm; |
190 | | - cooldownConfLock.writeLock().unlock(); |
| 186 | + synchronized (cooldownConfLock) { |
| 187 | + this.cooldownReplicaId = cooldownReplicaId; |
| 188 | + this.cooldownTerm = cooldownTerm; |
| 189 | + } |
191 | 190 | } |
192 | 191 |
|
193 | 192 | public long getCooldownReplicaId() { |
194 | 193 | return cooldownReplicaId; |
195 | 194 | } |
196 | 195 |
|
197 | 196 | public Pair<Long, Long> getCooldownConf() { |
198 | | - cooldownConfLock.readLock().lock(); |
199 | | - try { |
| 197 | + synchronized (cooldownConfLock) { |
200 | 198 | return Pair.of(cooldownReplicaId, cooldownTerm); |
201 | | - } finally { |
202 | | - cooldownConfLock.readLock().unlock(); |
203 | 199 | } |
204 | 200 | } |
205 | 201 |
|
|
0 commit comments