Package com.linkedin.davinci.helix
Class AbstractStateModelFactory
- java.lang.Object
-
- org.apache.helix.participant.statemachine.StateModelFactory<org.apache.helix.participant.statemachine.StateModel>
-
- com.linkedin.davinci.helix.AbstractStateModelFactory
-
- Direct Known Subclasses:
LeaderFollowerPartitionStateModelFactory
public abstract class AbstractStateModelFactory extends org.apache.helix.participant.statemachine.StateModelFactory<org.apache.helix.participant.statemachine.StateModel>
ModelFactory manages Helix state model creation.createNewStateModel(String, String)
is called every time a new resource is created. Since Helix internal maintains a map between model definition and model factory, each factory could only create 1 type of model.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.concurrent.ExecutorService
executorService
protected java.lang.String
instanceName
protected org.apache.logging.log4j.Logger
logger
protected java.util.concurrent.CompletableFuture<HelixPartitionStatusAccessor>
partitionPushStatusAccessorFuture
protected ParticipantStateTransitionStats
stateTransitionStats
protected ReadOnlyStoreRepository
storeMetadataRepo
-
Constructor Summary
Constructors Constructor Description AbstractStateModelFactory(IngestionBackend ingestionBackend, VeniceConfigLoader configService, java.util.concurrent.ExecutorService executorService, ParticipantStateTransitionStats stateTransitionStats, ReadOnlyStoreRepository storeMetadataRepo, java.util.concurrent.CompletableFuture<HelixPartitionStatusAccessor> partitionPushStatusAccessorFuture, java.lang.String instanceName)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract org.apache.helix.participant.statemachine.StateModel
createNewStateModel(java.lang.String resourceName, java.lang.String partitionName)
This method will be invoked only once per partition per sessionVeniceConfigLoader
getConfigService()
java.util.concurrent.ExecutorService
getExecutorService(java.lang.String resourceName)
IngestionBackend
getIngestionBackend()
static java.lang.String
getStateModelID(java.lang.String resourceName, int partitionId)
ParticipantStateTransitionStats
getStateTransitionStats(java.lang.String resourceName)
Use the right state transition stats for the resource.ReadOnlyStoreRepository
getStoreMetadataRepo()
void
shutDownExecutor()
void
waitExecutorTermination(long timeout, java.util.concurrent.TimeUnit unit)
-
Methods inherited from class org.apache.helix.participant.statemachine.StateModelFactory
createAndAddBatchMessageWrapper, createAndAddStateModel, createAndAddStateModel, createBatchMessageWrapper, createNewStateModel, getBatchMessageWrapper, getExecutorService, getExecutorService, getPartitionSet, getPartitionSet, getResourceSet, getStateModel, getStateModel, removeStateModel, removeStateModel
-
-
-
-
Field Detail
-
logger
protected final org.apache.logging.log4j.Logger logger
-
storeMetadataRepo
protected final ReadOnlyStoreRepository storeMetadataRepo
-
executorService
protected final java.util.concurrent.ExecutorService executorService
-
stateTransitionStats
protected final ParticipantStateTransitionStats stateTransitionStats
-
partitionPushStatusAccessorFuture
protected java.util.concurrent.CompletableFuture<HelixPartitionStatusAccessor> partitionPushStatusAccessorFuture
-
instanceName
protected final java.lang.String instanceName
-
-
Constructor Detail
-
AbstractStateModelFactory
public AbstractStateModelFactory(IngestionBackend ingestionBackend, VeniceConfigLoader configService, java.util.concurrent.ExecutorService executorService, ParticipantStateTransitionStats stateTransitionStats, ReadOnlyStoreRepository storeMetadataRepo, java.util.concurrent.CompletableFuture<HelixPartitionStatusAccessor> partitionPushStatusAccessorFuture, java.lang.String instanceName)
-
-
Method Detail
-
getExecutorService
public java.util.concurrent.ExecutorService getExecutorService(java.lang.String resourceName)
- Overrides:
getExecutorService
in classorg.apache.helix.participant.statemachine.StateModelFactory<org.apache.helix.participant.statemachine.StateModel>
-
getStateTransitionStats
public ParticipantStateTransitionStats getStateTransitionStats(java.lang.String resourceName)
Use the right state transition stats for the resource. By default, use the regular one; when dual state transition thread pool is enabled, use the future version stats for future version resource.
-
createNewStateModel
public abstract org.apache.helix.participant.statemachine.StateModel createNewStateModel(java.lang.String resourceName, java.lang.String partitionName)
This method will be invoked only once per partition per session- Overrides:
createNewStateModel
in classorg.apache.helix.participant.statemachine.StateModelFactory<org.apache.helix.participant.statemachine.StateModel>
- Parameters:
resourceName
- $(topic_name) where state transition is happeningpartitionName
- $(topic_name)_$(partition) for which the State Transition Handler is required- Returns:
- VenicePartitionStateModel for the partition.
-
getConfigService
public VeniceConfigLoader getConfigService()
-
getStoreMetadataRepo
public ReadOnlyStoreRepository getStoreMetadataRepo()
-
getIngestionBackend
public IngestionBackend getIngestionBackend()
-
getStateModelID
public static java.lang.String getStateModelID(java.lang.String resourceName, int partitionId)
-
shutDownExecutor
public void shutDownExecutor()
-
waitExecutorTermination
public void waitExecutorTermination(long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException
- Throws:
java.lang.InterruptedException
-
-