keith-turner commented on code in PR #5857:
URL: https://github.com/apache/accumulo/pull/5857#discussion_r2349516039
##########
test/src/main/java/org/apache/accumulo/test/functional/ZombieTServer.java:
##########
@@ -144,7 +145,24 @@ public static void main(String[] args) throws Exception {
metricsInfo.init(MetricsInfo.serviceTags(context.getInstanceName(),
"zombie.server",
serverPort.address, ResourceGroupId.DEFAULT));
- LockWatcher lw = new LockWatcher() {
+ final AtomicBoolean acquiredLock = new AtomicBoolean(false);
+
+ AccumuloLockWatcher lw = new AccumuloLockWatcher() {
Review Comment:
Not sure how well this would work, but wondering if making this an abstract
class would cut down on duplicate and inconsistent code across the sub types.
If this was something like the following , then the subtypes would not need to
implement the `isLocked()` method or have their own boolean, however they would
need to call `super.acquiredLock()` when they want to override that method.
```java
public static abstract class AccumuloLockWatcher {
final AtomicBoolean acquiredLock = new AtomicBoolean(false);
public boolean isLocked(){
return acquiredLock.get();
}
public void acquiredLock(){
Preconditions.checkState(acquiredLock.compareAndSet(false, true));
}
public abstract void failedToAcquireLock(Exception e);
public abstract void lostLock(LockLossReason reason);
/**
* lost the ability to monitor the lock node, and its status is unknown
*/
public abstract void unableToMonitorLockNode(Exception e);
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]