bookkeeper-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From si...@apache.org
Subject bookkeeper git commit: BOOKKEEPER-890: Concurrent modification exception when removing listener in…
Date Tue, 09 Feb 2016 07:23:39 GMT
Repository: bookkeeper
Updated Branches:
  refs/heads/master 8729d12be -> 626b7e8bb


BOOKKEEPER-890: Concurrent modification exception when removing listener in…

… Bookkeeper ZK ledger manager

Author: Matteo Merli <mmerli@apache.org>

Reviewers: Sijie Guo <sijie@apache.org>

Closes #9 from merlimat/bk-890-concurrent-modification


Project: http://git-wip-us.apache.org/repos/asf/bookkeeper/repo
Commit: http://git-wip-us.apache.org/repos/asf/bookkeeper/commit/626b7e8b
Tree: http://git-wip-us.apache.org/repos/asf/bookkeeper/tree/626b7e8b
Diff: http://git-wip-us.apache.org/repos/asf/bookkeeper/diff/626b7e8b

Branch: refs/heads/master
Commit: 626b7e8bb0b84271df97cfbf0a1b157c6cfe5a18
Parents: 8729d12
Author: Matteo Merli <mmerli@apache.org>
Authored: Mon Feb 8 23:23:34 2016 -0800
Committer: Sijie Guo <sijie@apache.org>
Committed: Mon Feb 8 23:23:34 2016 -0800

----------------------------------------------------------------------
 .../bookkeeper/meta/AbstractZkLedgerManager.java     | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/bookkeeper/blob/626b7e8b/bookkeeper-server/src/main/java/org/apache/bookkeeper/meta/AbstractZkLedgerManager.java
----------------------------------------------------------------------
diff --git a/bookkeeper-server/src/main/java/org/apache/bookkeeper/meta/AbstractZkLedgerManager.java
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/meta/AbstractZkLedgerManager.java
index 6636506..1d7c591 100644
--- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/meta/AbstractZkLedgerManager.java
+++ b/bookkeeper-server/src/main/java/org/apache/bookkeeper/meta/AbstractZkLedgerManager.java
@@ -195,16 +195,19 @@ abstract class AbstractZkLedgerManager implements LedgerManager, Watcher
{
             Set<LedgerMetadataListener> listenerSet = listeners.get(ledgerId);
             if (null != listenerSet) {
                 synchronized(listenerSet){
-                    LOG.debug("Removed ledger metadata listeners on ledger {} : {}",
-                            ledgerId, listenerSet);
-                    for(LedgerMetadataListener l : listenerSet) {
-                        unregisterLedgerMetadataListener(ledgerId, l);
+                    if (LOG.isDebugEnabled()) {
+                        LOG.debug("Removed ledger metadata listeners on ledger {} : {}",
+                                ledgerId, listenerSet);
+                    }
+                    for (LedgerMetadataListener l : listenerSet) {
                         l.onChanged( ledgerId, null );
                     }
+                    listeners.remove(ledgerId, listenerSet);
                 }
             } else {
-                LOG.debug("No ledger metadata listeners to remove from ledger {} after it's
deleted.",
-                        ledgerId);
+                if (LOG.isDebugEnabled()) {
+                    LOG.debug("No ledger metadata listeners to remove from ledger {} after
it's deleted.", ledgerId);
+                }
             }
             break;
         case NodeDataChanged:


Mime
View raw message