Skip to content

Commit

Permalink
fix close ledgerAuditorManager repeatedly (#3503)
Browse files Browse the repository at this point in the history
### 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 dbec4e9)
  • Loading branch information
wenbingshen authored and zymap committed Oct 26, 2022
1 parent 15fb058 commit 5a4f927
Showing 1 changed file with 1 addition and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -230,16 +230,11 @@ public BookieId getCurrentAuditor() throws IOException, InterruptedException {
* 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();
}
Expand Down

0 comments on commit 5a4f927

Please sign in to comment.