Class ZookeeperLastPrimaryHandler

java.lang.Object
com.gigaspaces.internal.server.space.ZookeeperLastPrimaryHandler

public class ZookeeperLastPrimaryHandler extends Object
Created by tamirs on 5/9/17.
  • Constructor Details

    • ZookeeperLastPrimaryHandler

      public ZookeeperLastPrimaryHandler(SpaceImpl spaceImpl, AttributeStore attributeStore, org.slf4j.Logger logger)
  • Method Details

    • toUnHealthyPath

      public static String toUnHealthyPath(String spaceName, String partitionId)
    • removeLastPrimaryRecord

      public void removeLastPrimaryRecord() throws IOException
      Throws:
      IOException
    • removeUnhealthyRecord

      public void removeUnhealthyRecord() throws IOException
      Throws:
      IOException
    • setMeAsLastPrimary

      public void setMeAsLastPrimary() throws IOException
      Throws:
      IOException
    • setMeAsLastPrimaryIfUnchanged

      public boolean setMeAsLastPrimaryIfUnchanged(String expectedLastPrimary) throws IOException
      PIC-6571: Sets this instance as last primary only if the current record still equals expectedLastPrimary (as read when leadership was offered). Prevents a stale promotion from overriding a newer primary's record.
      Returns:
      true if this instance is (now) the last primary, false if another instance has written the record meanwhile
      Throws:
      IOException
    • getMyLastPrimaryValue

      public String getMyLastPrimaryValue()
    • isMe

      public boolean isMe(String lastPrimaryValue)
      Returns:
      true if the given last primary record value denotes this exact instance (instance id AND space uuid).
    • setMeAsUnHealthy

      public void setMeAsUnHealthy() throws IOException
      Throws:
      IOException
    • isLastPrimary

      public boolean isLastPrimary()
    • isUnhealthy

      public boolean isUnhealthy()
    • getLastPrimaryName

      public String getLastPrimaryName() throws IOException
      Throws:
      IOException
    • getUnhealthyName

      public String getUnhealthyName() throws IOException
      Throws:
      IOException
    • getLastPrimaryNameMemoryXtend

      public String getLastPrimaryNameMemoryXtend() throws IOException
      Throws:
      IOException
    • getAttributeStoreKey

      public String getAttributeStoreKey()
    • getSeparator

      public static String getSeparator()
    • toPath

      public static String toPath(String spaceName, String partitionId)
    • toId

      public static String toId(String instanceId, String uid)