This is an automated email from the ASF dual-hosted git repository.
mmerli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git
The following commit(s) were added to refs/heads/master by this push:
new 6a17b3e [ML] Cancel scheduled tasks as the first step in closing
(#10739)
6a17b3e is described below
commit 6a17b3eed6e18e925b133720482ecdaf246e5ef5
Author: Lari Hotari <[email protected]>
AuthorDate: Fri May 28 20:37:14 2021 +0300
[ML] Cancel scheduled tasks as the first step in closing (#10739)
- when currentLedger was null, the scheduled tasks wouldn't get cancelled
---
.../apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git
a/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java
b/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java
index 4eb4e37..a338c30 100644
---
a/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java
+++
b/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java
@@ -1319,6 +1319,14 @@ public class ManagedLedgerImpl implements ManagedLedger,
CreateCallback {
factory.close(this);
STATE_UPDATER.set(this, State.Closed);
+ if (this.timeoutTask != null) {
+ this.timeoutTask.cancel(false);
+ }
+
+ if (this.checkLedgerRollTask != null) {
+ this.checkLedgerRollTask.cancel(false);
+ }
+
LedgerHandle lh = currentLedger;
if (lh == null) {
@@ -1349,13 +1357,6 @@ public class ManagedLedgerImpl implements ManagedLedger,
CreateCallback {
closeAllCursors(callback, ctx);
}, null);
- if (this.timeoutTask != null) {
- this.timeoutTask.cancel(false);
- }
-
- if (this.checkLedgerRollTask != null) {
- this.checkLedgerRollTask.cancel(false);
- }
}