public class DefaultSelfHealingService extends java.lang.Object implements SelfHealingService
| Modifier and Type | Class and Description |
|---|---|
static interface |
DefaultSelfHealingService.TestListener |
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
CFG_SELF_HEALING_BATCH_LIMIT |
static java.lang.String |
CFG_SELF_HEALING_ENABLED |
static java.lang.String |
CFG_SELF_HEALING_INTERVAL |
static int |
DEFAULT_SELF_HEALING_BATCH_LIMIT |
static boolean |
DEFAULT_SELF_HEALING_ENABLED |
static int |
DEFAULT_SELF_HEALING_INTERVAL_SECONDS |
| Constructor and Description |
|---|
DefaultSelfHealingService() |
| Modifier and Type | Method and Description |
|---|---|
void |
addItemToHeal(ItemToHeal itemToHeal)
Adds items to heal.
|
void |
afterPropertiesSet() |
void |
applyWorkerSettings()
Applies current background process settings.
|
void |
batchItems()
The method that is scheduled and run in thread in this bean.
|
void |
destroy() |
int |
getBatchLimit() |
int |
getInterval() |
boolean |
isEnabled()
Tells whether the self healing process is enabled.
|
void |
removeTestListener() |
void |
setBatchLimit(int batchLimit) |
void |
setEnabled(boolean enableSchedulerGlobal)
Flag enabling global Spring Scheduler task execution in this service
|
void |
setInterval(int interval) |
void |
setTestListener(DefaultSelfHealingService.TestListener listener) |
protected void |
setupFromConfig() |
protected void |
setupWorkerViaTenantListener() |
void |
setWritePersistenceGateway(WritePersistenceGateway writePersistenceGateway) |
protected void |
startWorkerIfNotRunning() |
protected void |
stopWorkerIfRunning() |
public static final java.lang.String CFG_SELF_HEALING_INTERVAL
public static final java.lang.String CFG_SELF_HEALING_BATCH_LIMIT
public static final java.lang.String CFG_SELF_HEALING_ENABLED
public static final int DEFAULT_SELF_HEALING_INTERVAL_SECONDS
public static final int DEFAULT_SELF_HEALING_BATCH_LIMIT
public static final boolean DEFAULT_SELF_HEALING_ENABLED
public void setTestListener(DefaultSelfHealingService.TestListener listener)
public void removeTestListener()
public void addItemToHeal(ItemToHeal itemToHeal)
SelfHealingService
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.
addItemToHeal in interface SelfHealingServiceitemToHeal - item for later scheduled processingpublic boolean isEnabled()
SelfHealingServiceisEnabled in interface SelfHealingServicepublic void batchItems()
Takes accumulated items and persist the changes that they represent.
Schedule setting can be overridden in local.properties
self.healing.interval and self.healing.enabled
SessionService is needed for disabling scheduler calls for this method during junit tests. When Spring
makes a call it will only get global scheduler.selfhealing.enabled flag. When junit test make a call they
will get the flag set in session service. That way scheduler wont interfere with manual junit calls.
public void destroy()
throws java.lang.Exception
java.lang.Exceptionpublic void afterPropertiesSet()
throws java.lang.Exception
java.lang.Exceptionprotected void setupWorkerViaTenantListener()
public void applyWorkerSettings()
protected void setupFromConfig()
protected void startWorkerIfNotRunning()
protected void stopWorkerIfRunning()
public void setInterval(int interval)
public int getInterval()
public void setWritePersistenceGateway(WritePersistenceGateway writePersistenceGateway)
public void setBatchLimit(int batchLimit)
public int getBatchLimit()
public void setEnabled(boolean enableSchedulerGlobal)
Copyright © 2018 SAP SE. All Rights Reserved.