ctubbsii commented on a change in pull request #1037: Switch to leader latch WIP
URL: https://github.com/apache/fluo/pull/1037#discussion_r192926817
##########
File path:
modules/core/src/main/java/org/apache/fluo/core/oracle/OracleServer.java
##########
@@ -357,8 +419,17 @@ public synchronized void stop() throws Exception {
if (curatorFramework.getState().equals(CuratorFrameworkState.STARTED)) {
pathChildrenCache.getListenable().removeListener(this);
pathChildrenCache.close();
- leaderSelector.close();
- curatorFramework.getConnectionStateListenable().removeListener(this);
+ leaderLatch.close();
+
+ execService.shutdown();
+
+ execService.awaitTermination(10, TimeUnit.SECONDS);
+
+
curatorFramework.getConnectionStateListenable().removeListener(cnxnListener);
+
+ // leaderLatch.close() schedules a background delete, give it a chance
to process before
+ // closing curator... this is done to avoid spurious exceptions, see
CURATOR-467
+ Thread.sleep(250);
Review comment:
An `InterruptedException` here will prevent the `curatorFramework.close()`
on the next line. Maybe do something like the following?
```java
try {
Thread.sleep(250);
} finally {
curatorFramework.close();
}
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services