Package com.linkedin.venice.helix
Class SafeHelixManager
java.lang.Object
com.linkedin.venice.helix.SafeHelixManager
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 Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
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, String instanceName, 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, 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
org.apache.helix.HelixAdmin
org.apache.helix.ConfigAccessor
org.apache.helix.healthcheck.ParticipantHealthReportCollector
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>
org.apache.helix.InstanceType
long
org.apache.helix.ClusterMessagingService
org.apache.helix.HelixManager
org.apache.helix.HelixManagerProperties
org.apache.helix.participant.StateMachineEngine
boolean
boolean
isLeader()
boolean
removeListener
(org.apache.helix.PropertyKey key, Object listener) void
setLiveInstanceInfoProvider
(org.apache.helix.LiveInstanceInfoProvider liveInstanceInfoProvider) void
void
-
Constructor Details
-
SafeHelixManager
public SafeHelixManager(org.apache.helix.HelixManager helixManager)
-
-
Method Details
-
connect
- Throws:
Exception
-
isConnected
public boolean isConnected() -
disconnect
public void disconnect() -
addIdealStateChangeListener
public void addIdealStateChangeListener(org.apache.helix.api.listeners.IdealStateChangeListener listener) throws Exception - Throws:
Exception
-
addLiveInstanceChangeListener
public void addLiveInstanceChangeListener(org.apache.helix.api.listeners.LiveInstanceChangeListener listener) throws Exception - Throws:
Exception
-
addInstanceConfigChangeListener
public void addInstanceConfigChangeListener(org.apache.helix.api.listeners.InstanceConfigChangeListener listener) throws Exception - Throws:
Exception
-
addResourceConfigChangeListener
public void addResourceConfigChangeListener(org.apache.helix.api.listeners.ResourceConfigChangeListener listener) throws Exception - Throws:
Exception
-
addClusterfigChangeListener
public void addClusterfigChangeListener(org.apache.helix.api.listeners.ClusterConfigChangeListener listener) throws Exception - Throws:
Exception
-
addConfigChangeListener
public void addConfigChangeListener(org.apache.helix.api.listeners.ScopedConfigChangeListener listener, org.apache.helix.model.HelixConfigScope.ConfigScopeProperty scope) throws Exception - Throws:
Exception
-
addMessageListener
public void addMessageListener(org.apache.helix.api.listeners.MessageListener listener, String instanceName) throws Exception - Throws:
Exception
-
addCurrentStateChangeListener
public void addCurrentStateChangeListener(org.apache.helix.api.listeners.CurrentStateChangeListener listener, String instanceName, String sessionId) throws Exception - Throws:
Exception
-
addExternalViewChangeListener
public void addExternalViewChangeListener(org.apache.helix.api.listeners.ExternalViewChangeListener listener) throws Exception - Throws:
Exception
-
addTargetExternalViewChangeListener
public void addTargetExternalViewChangeListener(org.apache.helix.api.listeners.ExternalViewChangeListener listener) throws Exception - Throws:
Exception
-
addControllerListener
public void addControllerListener(org.apache.helix.api.listeners.ControllerChangeListener listener) -
addControllerMessageListener
public void addControllerMessageListener(org.apache.helix.api.listeners.MessageListener listener) -
removeListener
-
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
-
getInstanceName
-
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
-
getProperties
public org.apache.helix.HelixManagerProperties getProperties() -
getStateMachineEngine
public org.apache.helix.participant.StateMachineEngine getStateMachineEngine() -
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()
-