Package com.linkedin.venice.helix
Class SafeHelixManager
- java.lang.Object
-
- com.linkedin.venice.helix.SafeHelixManager
-
public class SafeHelixManager extends java.lang.Object
A wrapper aroundHelixManager
which disables the unsafe functionality. Venice should never use aHelixManager
directly. All uses of this class should always be wrapped in aSafeHelixManager
. 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 theHelixManager
interface. Only one unsafe API is removed: -HelixManager.getHelixDataAccessor()
It is replaced by a similar function that returns aSafeHelixDataAccessor
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 Summary
Constructors Constructor Description SafeHelixManager(org.apache.helix.HelixManager helixManager)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addClusterfigChangeListener(org.apache.helix.api.listeners.ClusterConfigChangeListener listener)
void
addConfigChangeListener(org.apache.helix.api.listeners.ScopedConfigChangeListener listener, org.apache.helix.model.HelixConfigScope.ConfigScopeProperty scope)
void
addControllerListener(org.apache.helix.api.listeners.ControllerChangeListener listener)
void
addControllerMessageListener(org.apache.helix.api.listeners.MessageListener listener)
void
addCurrentStateChangeListener(org.apache.helix.api.listeners.CurrentStateChangeListener listener, java.lang.String instanceName, java.lang.String sessionId)
void
addExternalViewChangeListener(org.apache.helix.api.listeners.ExternalViewChangeListener listener)
void
addIdealStateChangeListener(org.apache.helix.api.listeners.IdealStateChangeListener listener)
void
addInstanceConfigChangeListener(org.apache.helix.api.listeners.InstanceConfigChangeListener listener)
void
addLiveInstanceChangeListener(org.apache.helix.api.listeners.LiveInstanceChangeListener listener)
void
addMessageListener(org.apache.helix.api.listeners.MessageListener listener, java.lang.String instanceName)
void
addPreConnectCallback(org.apache.helix.PreConnectCallback callback)
void
addResourceConfigChangeListener(org.apache.helix.api.listeners.ResourceConfigChangeListener listener)
void
addTargetExternalViewChangeListener(org.apache.helix.api.listeners.ExternalViewChangeListener listener)
void
connect()
void
disconnect()
org.apache.helix.HelixAdmin
getClusterManagmentTool()
java.lang.String
getClusterName()
org.apache.helix.ConfigAccessor
getConfigAccessor()
org.apache.helix.healthcheck.ParticipantHealthReportCollector
getHealthReportCollector()
SafeHelixDataAccessor
getHelixDataAccessor()
This function is incompatible with theHelixManager
interface, since the return type ofSafeHelixDataAccessor
is not compatible with the return of the unsafe interface, which is aHelixDataAccessor
.org.apache.helix.store.zk.ZkHelixPropertyStore<org.apache.helix.zookeeper.datamodel.ZNRecord>
getHelixPropertyStore()
java.lang.String
getInstanceName()
org.apache.helix.InstanceType
getInstanceType()
long
getLastNotificationTime()
org.apache.helix.ClusterMessagingService
getMessagingService()
org.apache.helix.HelixManager
getOriginalManager()
org.apache.helix.HelixManagerProperties
getProperties()
java.lang.String
getSessionId()
java.lang.Long
getSessionStartTime()
org.apache.helix.participant.StateMachineEngine
getStateMachineEngine()
java.lang.String
getVersion()
boolean
isConnected()
boolean
isLeader()
boolean
removeListener(org.apache.helix.PropertyKey key, java.lang.Object listener)
void
setLiveInstanceInfoProvider(org.apache.helix.LiveInstanceInfoProvider liveInstanceInfoProvider)
void
startTimerTasks()
void
stopTimerTasks()
-
-
-
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 theHelixManager
interface, since the return type ofSafeHelixDataAccessor
is not compatible with the return of the unsafe interface, which is aHelixDataAccessor
.
-
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()
-
-