public class

HelixCustomCodeRunner

extends Object
java.lang.Object
   ↳ org.apache.helix.participant.HelixCustomCodeRunner

Class Overview

This provides the ability for users to run a custom code in exactly one process using a LeaderStandBy state model.
A typical use case is when one uses CUSTOMIZED ideal state mode where the assignment of partition to nodes needs to change dynamically as the nodes go online/offline.
HelixCustomCodeRunner runner = new HelixCustomCodeRunner(manager,ZK_ADDR); runner .invoke(_callback) .on(ChangeType.LIVE_INSTANCE, ChangeType.IdealState) .usingLeaderStandbyModel("someUniqueId") .run()

Summary

Public Constructors
HelixCustomCodeRunner(HelixManager manager, String zkAddr)
Constructs a HelixCustomCodeRunner that will run exactly in one place
Public Methods
HelixCustomCodeRunner invoke(CustomCodeCallbackHandler callback)
callback to invoke when there is a change in cluster state specified by on( notificationTypes) This callback must be idempotent which means they should not depend on what changed instead simply read the cluster data and act on it.
HelixCustomCodeRunner on(ChangeType... notificationTypes)
ChangeTypes interested in, ParticipantLeaderCallback.callback method will be invoked on the
void start()
This method will be invoked when there is a change in any subscribed notificationTypes
void stop()
Stop customer code runner
HelixCustomCodeRunner usingLeaderStandbyModel(String id)
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public HelixCustomCodeRunner (HelixManager manager, String zkAddr)

Constructs a HelixCustomCodeRunner that will run exactly in one place

Public Methods

public HelixCustomCodeRunner invoke (CustomCodeCallbackHandler callback)

callback to invoke when there is a change in cluster state specified by on( notificationTypes) This callback must be idempotent which means they should not depend on what changed instead simply read the cluster data and act on it.

public HelixCustomCodeRunner on (ChangeType... notificationTypes)

ChangeTypes interested in, ParticipantLeaderCallback.callback method will be invoked on the

public void start ()

This method will be invoked when there is a change in any subscribed notificationTypes

Throws
Exception

public void stop ()

Stop customer code runner

public HelixCustomCodeRunner usingLeaderStandbyModel (String id)