Class DefaultProcessStateService
- java.lang.Object
-
- com.broadleafcommerce.search.index.core.AbstractProcessStateService
-
- com.broadleafcommerce.search.index.core.DefaultProcessStateService
-
- All Implemented Interfaces:
Distributable
,EventPublisher
,ProcessStateService
,org.springframework.beans.factory.Aware
,org.springframework.context.ApplicationContextAware
public class DefaultProcessStateService extends AbstractProcessStateService implements org.springframework.context.ApplicationContextAware
Default implementation of the ProcessStateService interface. This component is for use within a single JVM and assumes that the Spring ApplicationContext is configured to raise synchronous, in-VM events.- Author:
- Kelly Tisdell (ktisdell)
-
-
Constructor Summary
Constructors Constructor Description DefaultProcessStateService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getClusterMemberCount(com.broadleafcommerce.search.api.type.IndexableType type)
Returns the number of cluster members that may be working together to process data.boolean
isDistributed()
Indicates if this component is designed for use across JVMs.void
publishEvent(SearchIndexProcessEvent event)
Lightweight interface to publish an event.void
setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
-
Methods inherited from class com.broadleafcommerce.search.index.core.AbstractProcessStateService
endProcessState, failFast, failFast, getCorrelationId, getCurrentProcessStateHolder, getInstance, isFailed, isMaster, isProcessStateEnabled, startProcessState
-
-
-
-
Method Detail
-
publishEvent
public void publishEvent(SearchIndexProcessEvent event)
Description copied from interface:EventPublisher
Lightweight interface to publish an event. This component will delegate directly to Spring if it's not distributable. Otherwise, it will publish to whatever distributed event system is available (e.g. Kafka, JMS, RabbitMQ, Ignite Events, etc.) In the case of distributed events, the system should delegate to Spring on arrival of the event.- Specified by:
publishEvent
in interfaceEventPublisher
- Parameters:
event
- the event to publish
-
isDistributed
public final boolean isDistributed()
Description copied from interface:Distributable
Indicates if this component is designed for use across JVMs.- Specified by:
isDistributed
in interfaceDistributable
- Returns:
- whether this component can be distributed across JVMs
-
getClusterMemberCount
public final int getClusterMemberCount(com.broadleafcommerce.search.api.type.IndexableType type)
Description copied from interface:ProcessStateService
Returns the number of cluster members that may be working together to process data. IfDistributable.isDistributed()
is false, then this should ALWAYS return 1.- Specified by:
getClusterMemberCount
in interfaceProcessStateService
- Parameters:
type
- the indexable type for which to get the cluster member count- Returns:
- the number of cluster members that may be working together to process data
-
setApplicationContext
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
- Specified by:
setApplicationContext
in interfaceorg.springframework.context.ApplicationContextAware
-
-