Class SafeHelixManager


  • public class SafeHelixManager
    extends java.lang.Object
    A wrapper around HelixManager which disables the unsafe functionality. Venice should never use a HelixManager directly. All uses of this class should always be wrapped in a SafeHelixManager. In order to ensure a compile-time guarantee that only safe APIs are called, we explicitly choose to remove the unsafe APIs from the interface. Therefore, we do not actually implement the HelixManager interface. Only one unsafe API is removed: - HelixManager.getHelixDataAccessor() It is replaced by a similar function that returns a SafeHelixDataAccessor instead. Besides the unsafe APIs, this class also takes away all of the APIs which Helix itself declares to be deprecated. These are the removed deprecated APIs: - HelixManager.addIdealStateChangeListener(org.apache.helix.IdealStateChangeListener) - HelixManager.addLiveInstanceChangeListener(org.apache.helix.LiveInstanceChangeListener) - HelixManager.addConfigChangeListener(ConfigChangeListener) - HelixManager.addInstanceConfigChangeListener(org.apache.helix.InstanceConfigChangeListener) - HelixManager.addConfigChangeListener(org.apache.helix.ScopedConfigChangeListener, HelixConfigScope.ConfigScopeProperty) - HelixManager.addMessageListener(org.apache.helix.MessageListener, String) - HelixManager.addCurrentStateChangeListener(org.apache.helix.CurrentStateChangeListener, String, String) - HelixManager.addExternalViewChangeListener(org.apache.helix.ExternalViewChangeListener) - HelixManager.addControllerListener(org.apache.helix.ControllerChangeListener) - HelixManager.addControllerMessageListener(org.apache.helix.MessageListener) TODO: Review the rest of the functions and determine if more should be culled.
    • Constructor Detail

      • SafeHelixManager

        public SafeHelixManager​(org.apache.helix.HelixManager helixManager)
    • Method Detail

      • connect

        public void connect()
                     throws java.lang.Exception
        Throws:
        java.lang.Exception
      • isConnected

        public boolean isConnected()
      • disconnect

        public void disconnect()
      • addIdealStateChangeListener

        public void addIdealStateChangeListener​(org.apache.helix.api.listeners.IdealStateChangeListener listener)
                                         throws java.lang.Exception
        Throws:
        java.lang.Exception
      • addLiveInstanceChangeListener

        public void addLiveInstanceChangeListener​(org.apache.helix.api.listeners.LiveInstanceChangeListener listener)
                                           throws java.lang.Exception
        Throws:
        java.lang.Exception
      • addInstanceConfigChangeListener

        public void addInstanceConfigChangeListener​(org.apache.helix.api.listeners.InstanceConfigChangeListener listener)
                                             throws java.lang.Exception
        Throws:
        java.lang.Exception
      • addResourceConfigChangeListener

        public void addResourceConfigChangeListener​(org.apache.helix.api.listeners.ResourceConfigChangeListener listener)
                                             throws java.lang.Exception
        Throws:
        java.lang.Exception
      • addClusterfigChangeListener

        public void addClusterfigChangeListener​(org.apache.helix.api.listeners.ClusterConfigChangeListener listener)
                                         throws java.lang.Exception
        Throws:
        java.lang.Exception
      • addConfigChangeListener

        public void addConfigChangeListener​(org.apache.helix.api.listeners.ScopedConfigChangeListener listener,
                                            org.apache.helix.model.HelixConfigScope.ConfigScopeProperty scope)
                                     throws java.lang.Exception
        Throws:
        java.lang.Exception
      • addMessageListener

        public void addMessageListener​(org.apache.helix.api.listeners.MessageListener listener,
                                       java.lang.String instanceName)
                                throws java.lang.Exception
        Throws:
        java.lang.Exception
      • addCurrentStateChangeListener

        public void addCurrentStateChangeListener​(org.apache.helix.api.listeners.CurrentStateChangeListener listener,
                                                  java.lang.String instanceName,
                                                  java.lang.String sessionId)
                                           throws java.lang.Exception
        Throws:
        java.lang.Exception
      • addExternalViewChangeListener

        public void addExternalViewChangeListener​(org.apache.helix.api.listeners.ExternalViewChangeListener listener)
                                           throws java.lang.Exception
        Throws:
        java.lang.Exception
      • addTargetExternalViewChangeListener

        public void addTargetExternalViewChangeListener​(org.apache.helix.api.listeners.ExternalViewChangeListener listener)
                                                 throws java.lang.Exception
        Throws:
        java.lang.Exception
      • addControllerListener

        public void addControllerListener​(org.apache.helix.api.listeners.ControllerChangeListener listener)
      • addControllerMessageListener

        public void addControllerMessageListener​(org.apache.helix.api.listeners.MessageListener listener)
      • removeListener

        public boolean removeListener​(org.apache.helix.PropertyKey key,
                                      java.lang.Object listener)
      • getHelixDataAccessor

        public SafeHelixDataAccessor getHelixDataAccessor()
        This function is incompatible with the HelixManager interface, since the return type of SafeHelixDataAccessor is not compatible with the return of the unsafe interface, which is a HelixDataAccessor.
      • getConfigAccessor

        public org.apache.helix.ConfigAccessor getConfigAccessor()
      • getClusterName

        public java.lang.String getClusterName()
      • getInstanceName

        public java.lang.String getInstanceName()
      • getSessionId

        public java.lang.String getSessionId()
      • getLastNotificationTime

        public long getLastNotificationTime()
      • getClusterManagmentTool

        public org.apache.helix.HelixAdmin getClusterManagmentTool()
      • getHelixPropertyStore

        public org.apache.helix.store.zk.ZkHelixPropertyStore<org.apache.helix.zookeeper.datamodel.ZNRecord> getHelixPropertyStore()
      • getMessagingService

        public org.apache.helix.ClusterMessagingService getMessagingService()
      • getInstanceType

        public org.apache.helix.InstanceType getInstanceType()
      • getVersion

        public java.lang.String getVersion()
      • getProperties

        public org.apache.helix.HelixManagerProperties getProperties()
      • getStateMachineEngine

        public org.apache.helix.participant.StateMachineEngine getStateMachineEngine()
      • getSessionStartTime

        public java.lang.Long getSessionStartTime()
      • isLeader

        public boolean isLeader()
      • startTimerTasks

        public void startTimerTasks()
      • stopTimerTasks

        public void stopTimerTasks()
      • addPreConnectCallback

        public void addPreConnectCallback​(org.apache.helix.PreConnectCallback callback)
      • setLiveInstanceInfoProvider

        public void setLiveInstanceInfoProvider​(org.apache.helix.LiveInstanceInfoProvider liveInstanceInfoProvider)
      • getHealthReportCollector

        public org.apache.helix.healthcheck.ParticipantHealthReportCollector getHealthReportCollector()
      • getOriginalManager

        public org.apache.helix.HelixManager getOriginalManager()