You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bookkeeper.apache.org by yo...@apache.org on 2022/10/26 01:11:44 UTC
[bookkeeper] 02/11: fix close ledgerAuditorManager repeatedly (#3503)
This is an automated email from the ASF dual-hosted git repository.
yong pushed a commit to branch branch-4.15
in repository https://gitbox.apache.org/repos/asf/bookkeeper.git
commit 5a4f9278afb1e0a3cd9067dd3e79c4ee7c55a285
Author: wenbingshen <ol...@gmail.com>
AuthorDate: Wed Oct 19 14:30:48 2022 +0800
fix close ledgerAuditorManager repeatedly (#3503)
### Motivation
this introduced in #2842, the `ledgerAuditorManager` will be close repeatedly.
```java
private void submitShutdownTask() {
executor.submit(new Runnable() {
@Override
public void run() {
if (!running.compareAndSet(true, false)) {
return;
}
try {
ledgerAuditorManager.close(); <- here has already closed LAM.
} catch (InterruptedException ie) {
Thread.currentThread().interrupt();
LOG.warn("InterruptedException while closing ledger auditor manager", ie);
} catch (Exception ke) {
LOG.error("Exception while closing ledger auditor manager", ke);
}
}
});
}
```
(cherry picked from commit dbec4e91eca20566a4db1673e9db1d728f659960)
---
.../java/org/apache/bookkeeper/replication/AuditorElector.java | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/bookkeeper-server/src/main/java/org/apache/bookkeeper/replication/AuditorElector.java b/bookkeeper-server/src/main/java/org/apache/bookkeeper/replication/AuditorElector.java
index eaab84c7b1..badd5fd26e 100644
--- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/replication/AuditorElector.java
+++ b/bookkeeper-server/src/main/java/org/apache/bookkeeper/replication/AuditorElector.java
@@ -230,16 +230,11 @@ public class AuditorElector {
* Shutting down AuditorElector.
*/
public void shutdown() throws InterruptedException {
- try {
- ledgerAuditorManager.close();
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
-
synchronized (this) {
if (executor.isShutdown()) {
return;
}
+ // close auditor manager
submitShutdownTask();
executor.shutdown();
}