Class DefaultSelfHealingService
java.lang.Object
de.hybris.platform.directpersistence.selfhealing.impl.DefaultSelfHealingService
- All Implemented Interfaces:
SelfHealingService,org.springframework.beans.factory.DisposableBean,org.springframework.beans.factory.InitializingBean
public class DefaultSelfHealingService
extends Object
implements SelfHealingService, org.springframework.beans.factory.InitializingBean, org.springframework.beans.factory.DisposableBean
Default implementation of self healing service
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddItemToHeal(ItemToHeal itemToHeal) Adds items to heal.voidvoidApplies current background process settings.voidThe method that is scheduled and run in thread in this bean.voiddestroy()intintbooleanTells whether the self healing process is enabled.voidvoidsetBatchLimit(int batchLimit) voidsetEnabled(boolean enableSchedulerGlobal) Flag enabling global Spring Scheduler task execution in this servicevoidsetInterval(int interval) voidprotected voidprotected voidvoidsetWritePersistenceGateway(WritePersistenceGateway writePersistenceGateway) protected voidprotected void
-
Field Details
-
CFG_SELF_HEALING_INTERVAL
- See Also:
-
CFG_SELF_HEALING_BATCH_LIMIT
- See Also:
-
CFG_SELF_HEALING_ENABLED
- See Also:
-
DEFAULT_SELF_HEALING_INTERVAL_SECONDS
public static final int DEFAULT_SELF_HEALING_INTERVAL_SECONDS- See Also:
-
DEFAULT_SELF_HEALING_BATCH_LIMIT
public static final int DEFAULT_SELF_HEALING_BATCH_LIMIT- See Also:
-
DEFAULT_SELF_HEALING_ENABLED
public static final boolean DEFAULT_SELF_HEALING_ENABLED- See Also:
-
-
Constructor Details
-
DefaultSelfHealingService
public DefaultSelfHealingService()
-
-
Method Details
-
setTestListener
-
removeTestListener
public void removeTestListener() -
addItemToHeal
Description copied from interface:SelfHealingServiceAdds items to heal.Accumulates those items for scheduled processing through
WritePersistenceGateway.persist(ChangeSet changeSet).The scheduled method is
batchItems().Item will be only passed to WritePersistenceGateway when current transaction is committed.
- Specified by:
addItemToHealin interfaceSelfHealingService- Parameters:
itemToHeal- item for later scheduled processing
-
isEnabled
public boolean isEnabled()Description copied from interface:SelfHealingServiceTells whether the self healing process is enabled.- Specified by:
isEnabledin interfaceSelfHealingService
-
batchItems
public void batchItems()The method that is scheduled and run in thread in this bean.Takes accumulated items and persist the changes that they represent.
Schedule setting can be overridden in
local.propertiesself.healing.intervalandself.healing.enabledSessionService is needed for disabling scheduler calls for this method during junit tests. When Spring makes a call it will only get global
scheduler.selfhealing.enabledflag. When junit test make a call they will get the flag set in session service. That way scheduler wont interfere with manual junit calls. -
destroy
- Specified by:
destroyin interfaceorg.springframework.beans.factory.DisposableBean- Throws:
Exception
-
afterPropertiesSet
- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean- Throws:
Exception
-
setupWorkerViaTenantListener
protected void setupWorkerViaTenantListener() -
applyWorkerSettings
public void applyWorkerSettings()Applies current background process settings. If enabled it will ensure that the worker is started (if not running yet). If disabled it will stop the worker (if it was running before). -
setupFromConfig
protected void setupFromConfig() -
startWorkerIfNotRunning
protected void startWorkerIfNotRunning() -
stopWorkerIfRunning
protected void stopWorkerIfRunning() -
setInterval
public void setInterval(int interval) -
getInterval
public int getInterval() -
setWritePersistenceGateway
-
setBatchLimit
public void setBatchLimit(int batchLimit) -
getBatchLimit
public int getBatchLimit() -
setEnabled
public void setEnabled(boolean enableSchedulerGlobal) Flag enabling global Spring Scheduler task execution in this service
-