Skip to content

Commit 5f48e23

Browse files
author
Suranjan Kumar
committed
Instead of sync on PersistentMemberManager using CopyOnWrite structure
There was a deadlock with revoke and unblock where revoke was taking lock on PersistentMemberManager and then requires lock on PersistenceAdvisorImpl. The intialization thread takes lock PersistenceAdvisorImpl and then to check whether the diskid is unblocked and requires lock on PersistentmemberManager
1 parent bf2d978 commit 5f48e23

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/persistence/PersistentMemberManager.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import com.gemstone.gemfire.distributed.internal.ProfileListener;
3131
import com.gemstone.gemfire.distributed.internal.membership.InternalDistributedMember;
3232
import com.gemstone.gemfire.i18n.LogWriterI18n;
33+
import com.gemstone.gemfire.internal.CopyOnWriteHashSet;
3334
import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
3435
import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
3536
import com.gemstone.gemfire.internal.util.TransformUtils;
@@ -47,7 +48,7 @@ public class PersistentMemberManager {
4748
private Map<PersistentMemberPattern, PendingRevokeListener> pendingRevokes
4849
= new HashMap<PersistentMemberPattern, PendingRevokeListener>();
4950

50-
private final Set<PersistentMemberPattern> doNotWait = new HashSet();
51+
private final Set<PersistentMemberPattern> doNotWait = new CopyOnWriteHashSet();
5152
private volatile boolean unblockNonHostingBuckets = false;
5253

5354
private static final Object TOKEN = new Object();
@@ -69,7 +70,7 @@ public void revokeMember(PersistentMemberPattern pattern) {
6970
}
7071

7172
public boolean doNotWaitOnMember(PersistentMemberID id) {
72-
synchronized (this) {
73+
if (this.unblockNonHostingBuckets) {
7374
for (PersistentMemberPattern p : this.doNotWait) {
7475
if (p.matches(id))
7576
return true;

0 commit comments

Comments
 (0)