Class DefaultSelfHealingService

  • All Implemented Interfaces:
    SelfHealingService, org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.InitializingBean

    public class DefaultSelfHealingService
    extends java.lang.Object
    implements SelfHealingService, org.springframework.beans.factory.InitializingBean, org.springframework.beans.factory.DisposableBean
    Default implementation of self healing service
    • Field Detail

      • CFG_SELF_HEALING_INTERVAL

        public static final java.lang.String CFG_SELF_HEALING_INTERVAL
        See Also:
        Constant Field Values
      • CFG_SELF_HEALING_BATCH_LIMIT

        public static final java.lang.String CFG_SELF_HEALING_BATCH_LIMIT
        See Also:
        Constant Field Values
      • CFG_SELF_HEALING_ENABLED

        public static final java.lang.String CFG_SELF_HEALING_ENABLED
        See Also:
        Constant Field Values
      • DEFAULT_SELF_HEALING_INTERVAL_SECONDS

        public static final int DEFAULT_SELF_HEALING_INTERVAL_SECONDS
        See Also:
        Constant Field Values
      • DEFAULT_SELF_HEALING_BATCH_LIMIT

        public static final int DEFAULT_SELF_HEALING_BATCH_LIMIT
        See Also:
        Constant Field Values
      • DEFAULT_SELF_HEALING_ENABLED

        public static final boolean DEFAULT_SELF_HEALING_ENABLED
        See Also:
        Constant Field Values
    • Constructor Detail

      • DefaultSelfHealingService

        public DefaultSelfHealingService()
    • Method Detail

      • removeTestListener

        public void removeTestListener()
      • 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.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.

      • destroy

        public void destroy()
                     throws java.lang.Exception
        Specified by:
        destroy in interface org.springframework.beans.factory.DisposableBean
        Throws:
        java.lang.Exception
      • afterPropertiesSet

        public void afterPropertiesSet()
                                throws java.lang.Exception
        Specified by:
        afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
        Throws:
        java.lang.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

        public void setWritePersistenceGateway​(WritePersistenceGateway writePersistenceGateway)
      • 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