From 5d5401f02b3dbc89f5d45d5449fb7103c9103916 Mon Sep 17 00:00:00 2001 From: Vatsal Mevada Date: Tue, 24 Mar 2020 11:34:52 +0530 Subject: [PATCH] Fixing some failing store tests. Related to: SDENT-175 --- .../com/pivotal/gemfirexd/internal/engine/Misc.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/gemfirexd/core/src/main/java/com/pivotal/gemfirexd/internal/engine/Misc.java b/gemfirexd/core/src/main/java/com/pivotal/gemfirexd/internal/engine/Misc.java index 43828c083..b760c6c26 100644 --- a/gemfirexd/core/src/main/java/com/pivotal/gemfirexd/internal/engine/Misc.java +++ b/gemfirexd/core/src/main/java/com/pivotal/gemfirexd/internal/engine/Misc.java @@ -281,8 +281,16 @@ public static Set getLeadNodes() { * @return Optional of DistributedMember representing primary lead node if primary lead exists in cluster * Optional#empty if primary lead node does not exist in cluster */ - public static Optional getPrimaryLead(){ - return getLeadNodes().stream().filter(dm -> GemFireXDUtils.getGfxdProfile(dm).hasSparkURL()).findFirst(); + public static Optional getPrimaryLead() { + try { + return getLeadNodes().stream().filter(dm -> GemFireXDUtils.getGfxdProfile(dm).hasSparkURL()).findFirst(); + } catch (NoMemberFoundException ex) { + if (ex.getMessage().equals("SnappyData Lead node is not available")) { + return Optional.empty(); + } else { + throw ex; + } + } } /**